HTML/CSS

Started by Jh0nnY2k, April 06, 2016, 01:14:59 PM

Previous topic - Next topic

Jh0nnY2k

So i got this on HTML part :

<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
        <link rel="stylesheet" type="text/css" href="main.css" />
    </head>
    <body>
        <p id="paragraf" name="paragraf">Ana are mere!</p>
    </body>
</html>


And this part on CSS Part

.paragraf:hover{
    color: brown;
    pointer-events: visibleStroke;
}

What am i doing wrong?

if i put :

p:hover{
    color: brown;
    pointer-events: visibleStroke;
}

It works. If i use the id "paragraf" it won't turn the text brown. Help?

BlackFired

Id for use in the css should be:

#paragraf

And for classes is as follows:

.paragraf



That was the problem in the css you gave style to a class when you have a id.



#paragraf:hover{
    color: brown;
    pointer-events: visibleStroke;
}

Алексей

Since it wasn't mentioned, I'll add in:

p:hover

works for you because it's selecting every "p" tag on the page, which obviously includes your #paragraf element.

-[Все слова это только слова.]-