3

我如何强调<ul>但不是<li>

我的CSS是

#rightcol { width:170px; min-height:350px; float:right; 
         background:#fff; border:1px solid #666; border-radius:5px; }

#rightcol > ul { list-style:none; line-height:2em; padding-left:0; 
        font-weight:bold; text-decoration:underline; text-align:center; }

#rightcol > ul > li { padding-left:20px; font-weight:normal; 
        font-size:12px; text-decoration:none; text-align:left; }

但是<li>CSS"text-decoration:none"不起作用。

4

2 回答 2

1

添加display: inline-blockli标签:

#rightcol { width:170px; min-height:350px; float:right; 
         background:#fff; border:1px solid #666; border-radius:5px; }

#rightcol > ul { list-style:none; line-height:2em; padding-left:0; 
        font-weight:bold; text-decoration:underline; text-align:center; }

#rightcol > ul > li { display:inline-block;
        padding-left:20px; font-weight:normal; 
        font-size:12px; text-decoration:none; text-align:left; }

见:http: //jsfiddle.net/6e3WP/

您将需要更新text-alignment以确保获得预期的结果。

于 2013-09-17T17:15:53.553 回答
0

你可以这样尝试:-

#rightcol { width:170px; min-height:350px; float:right; 
         background:#fff; border:1px solid #666; border-radius:5px; }

#rightcol > ul { list-style:none; line-height:2em; padding-left:0; 
        font-weight:bold; text-decoration:underline; text-align:center; }

#rightcol > ul > li { padding-left:20px; font-weight:normal; 
        font-size:12px; text-decoration:none !important; text-align:left; }
于 2013-09-17T16:48:07.377 回答