How can I add hover in my css code | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How can I add hover in my css code

I try to add the hover effect to my codes but I don't see it working A code like this .intro :hover{ border:1px solid; }

18th Jun 2019, 2:31 AM
Emmanuel Adams
4 Answers
+ 9
Can we see your code?
18th Jun 2019, 2:36 AM
JTLZ
+ 3
If you have the following: p { text-align: center; } You can add this as a separate style declaration p:hover { background-color: #ccccff; }
18th Jun 2019, 3:38 AM
Adam
Adam - avatar
+ 3
First, you have a space between .intro:hover Second, you need content in your div. To activate the hover <head> <style> .intro:hover { border: 5px solid black; } </style> </head> <body> <div class="intro"> <h2>The border Property</h2> <p>This property is a shorthand property for border-width, border-style, and border-color.</p> </div> </body>
18th Jun 2019, 4:22 AM
Chris Coder
Chris Coder - avatar
+ 3
because your border doesn't have a color.
18th Jun 2019, 8:12 AM
Gordon
Gordon - avatar