Hello, I have tried various combinations but still cannot get the desired background color to display when hovering over my <p>
element. I am looking for a CSS-only solution and not interested in using JavaScript hover events.
I would appreciate it if someone could explain why this code is not working and what the correct approach should be. I have experimented with different syntax such as
:hover {. &:hover {, ':hover': {, '&:hover': {
but none seem to give me the desired outcome.
Thank you in advance for your help.
import React from "react";
import styled from "styled-components";
const Thing = styled.p`
background: none;
width:200px;
padding:20px;
text-align: center;
border: 1px solid white;
margin: auto;
':hover': {
background: red;
textDecoration: underline;
}
`;
export const BorderButton = ({text}) => (
<Thing>
{text}
</Thing>
);