Below is the code in which I tried using text-decoration:none. However, text is always underlined.
<html>
<hea开发者_如何转开发d>
<style type="text/css">
.search, .search_b1, .search_b2{
display: block;
color: #000;
text-decoration: none;
}
.search_b1:hover {
color: red;
}
</style>
</head>
<body>
<div id="left">
<a href = "#">
<span class="search">
<span class="search_b1">Text text</span>
<span class="search_b2">Text text</span>
</span>
</a>
</div>
</body>
</html>
You set the span element to a block element.
Block elements can not have text-decoration
. Only inline elements can.
You need to apply the text-decoration to the anchor elements.
精彩评论