开发者

can we have list style type of a list a green color dot?

Can we do list style type of a list a green color dot?

My restrictions are i do not want to use list style image and i cannot edit the html in unorder开发者_StackOverflow社区ed list.


An update of naveen's answer, with the bullet character to get a better render.

ul#mylist{
    list-style-type: square;
}
ul#mylist li:before{
    content: "•";
    margin-right: 10px;
    font-weight: bold;
    color: #00FF00;
}

I'm wondering if this one is legal, as the code contains a special character.

Antoine


here check this out Html:

<ul>
<li><span>1</span></li>
<li><span>2</span></li>
<li><span>3</span></li>
</ul>

CSS:

ul {
margin:0px 0px 0px 20px;
padding:0px;
}
ul li {
color:green;
}
ul li span{
color:blue;
}

Click here : http://jsfiddle.net/thilakar/yYkC4/


If you wanted to use jQuery to manipulate the HTML.

Assuming HTML

<ul id="list">
    <li>One</li>
    <li>Two</li>
</ul>

CSS

ul{margin:20px; list-style-type:disc; color:green;}
li span{color:black;}

script

$('#list li').each(function(){
    $(this).replaceWith('<li><span>' + $(this).text() + '</span></li>');
}); 

Example: http://jsfiddle.net/jasongennaro/wTkQv/1/


Maybe Im not the smartest in the world but this is my way for this problem :

<ul>
<li><p style="color:#4ec3f4; float:left;">&bull;</p>tadam bss</li>
</ul>
  • No javascript,
  • no jQuery,
  • no css tricks/hack
  • agree with wc3


Here is an ugly hack using :before

ul#mylist{
    list-style-type: square;
}
ul#mylist li:before{
    content: ".";
    margin-right: 10px;
    font-weight: bold;
    color: #00FF00;
}

Demo here: http://jsfiddle.net/naveen/MSTvs/

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜