如何使无序列表的项目符号与列表项具有不同的文本修饰

时间:2014-11-03 17:10:18

标签: html css

我需要的是什么:要加下划线的列表项和与项目符号不同的颜色,不应加下划线

我尝试了什么:

我的问题是http://jsfiddle.net/g7fgy70c/

HTML (无法更改此结构,因为我正在使用CMS)

<ul>
    <li><a hfref="http://www.google.com">This should be underlined, but the bullet before it should not be</a></li>
     <li><a hfref="http://www.google.com">This should be underlined, but the bullet before it should not be</a></li>   
     <li><a hfref="http://www.google.com">This should be underlined, but the bullet before it should not be</a></li>
</ul>

CSS

ul
{
    list-style-type: none;
}

a
{
    text-decoration: underline;
}

li > a:before
{
    content: "\002022";
    color: red;
    padding-right: 5px;
    /* text-decoration: none; DOES NOT WORK, THE BULLETS ARE STILL UNDERLINED */
}

1 个答案:

答案 0 :(得分:1)

目标li not li&gt; a:http://jsfiddle.net/g7fgy70c/3/

li:before
{
    content: "\002022";
    color: red;
    padding-right: 5px;
}