我需要删除超链接中的下划线.
<div id='something'>
<h2>
<a href='http://somerandomurl'>Photo</a>
</h2>
</div>
Run Code Online (Sandbox Code Playgroud)
我正在使用这个CSS,但它不起作用.
#something h2 a{text-decoration:none}
Run Code Online (Sandbox Code Playgroud)
这是你想要的CSS:
#something a:link {text-decoration:none;}
#something a:visited {text-decoration:none;}
#something a:hover {text-decoration:underline;}
#something a:active {text-decoration:underline;}
Run Code Online (Sandbox Code Playgroud)
您要定位的特定CSS取决于您要查找的内容.例如,如果您希望"某些内容"中的所有链接都不加下划线,请执行上面所写的操作.但是如果你想要所有链接没有加下划线,你就不会把#something等等.如果你不确定我的意思,请阅读上下文选择器.这是很好的链接.
http://www.daaq.net/old/css/index.php?page=css+context+selectors&parent=css+syntax
希望有所帮助