I need to get rid of an underline in a hyperlink.
<div id='something'>
<h2>
<a href='http://somerandomurl'>Photo</a>
</h2>
</div>
I'm using this CSS, but it won't work.
#something h2 a{text-decoration:none}
Here is the css you want:
#something a:link {text-decoration:none;}
#something a:visited {text-decoration:none;}
#something a:hover {text-decoration:underline;}
#something a:active {text-decoration:underline;}
The specific CSS you want to target depends on what exactly you are looking for. For example, if you want all links in 'something' to not be underlined, do what I wrote above. But if you wanted all links to not be underlined, you would not put the #something, etc. Read about context selectors if your not sure what I mean. Here is good link.
http://www.daaq.net/old/css/index.php?page=css+context+selectors&parent=css+syntax
Hope that helps
a:link, a:visited { text-decoration: none; }
what is #ugc
?
you need...
#something h2 a { text-decoration: none; }
you can also define
a:hover, a:link, a:visited
...if needed for different states
The style you have should work, except the id
in your selector is wrong..it should be
#something h2 a{text-decoration:none}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.