Html 我们可以用绿色点的列表样式吗?
我们可以做一个绿色点的列表样式类型吗Html 我们可以用绿色点的列表样式吗?,html,css,Html,Css,我们可以做一个绿色点的列表样式类型吗 我的限制是我不想使用列表样式的图像,也不能编辑无序列表中的html。这里有一个使用:before ul#mylist{ list-style-type: square; } ul#mylist li:before{ content: "."; margin-right: 10px; font-weight: bold; color: #00FF00; } 此处演示:此处查看此内容 Html: 单击此处:更新navee
我的限制是我不想使用列表样式的图像,也不能编辑无序列表中的html。这里有一个使用
:before
ul#mylist{
list-style-type: square;
}
ul#mylist li:before{
content: ".";
margin-right: 10px;
font-weight: bold;
color: #00FF00;
}
此处演示:此处查看此内容
Html:
单击此处:更新naveen的答案,使用项目符号字符以获得更好的渲染效果
ul#mylist{
list-style-type: square;
}
ul#mylist li:before{
content: "•";
margin-right: 10px;
font-weight: bold;
color: #00FF00;
}
我想知道这个是否合法,因为代码包含一个特殊字符
Antoine如果您想使用jQuery操作HTML 假设HTML
<ul id="list">
<li>One</li>
<li>Two</li>
</ul>
剧本
$('#list li').each(function(){
$(this).replaceWith('<li><span>' + $(this).text() + '</span></li>');
});
$('#list li')。每个(函数(){
$(this).replace为(''+$(this).text()+' ');
});
示例:也许我不是世界上最聪明的,但这是我解决这个问题的方法:
<ul>
<li><p style="color:#4ec3f4; float:left;">•</p>tadam bss</li>
</ul>
&bull
塔达姆bss
- 没有javascript
- 没有jQuery
- 没有css技巧/黑客
- 同意wc3
ul{margin:20px; list-style-type:disc; color:green;}
li span{color:black;}
$('#list li').each(function(){
$(this).replaceWith('<li><span>' + $(this).text() + '</span></li>');
});
<ul>
<li><p style="color:#4ec3f4; float:left;">•</p>tadam bss</li>
</ul>