开发者

html + css text-decoration

开发者 https://www.devze.com 2023-01-31 01:54 出处:网络
Below is the code in which I tried using text-decoration:none. However, text is always underlined. <html>

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消