如何仅使用内联CSS自定义无序列表项目符号(用于电子邮件)



我正在寻找一种方法,用唯一的基于Unicode字符的项目符号和间距替换标准无序列表(<ul><li>...</li></ul>(项目符号和间隔,只使用内联CSS(用于HTML电子邮件(。

以下是我通常在标准HTML网页的"外部"CSS文件中使用的代码:

ul.med_sqr_bul_ul
{
list-style:none !important;
padding:0px !important;
}
ul.med_sqr_bul_ul li:before
{
content:'25AA';
margin:0 0.28em;
font-size:150% !important;
vertical-align:-10%;
}

问题是HTML电子邮件被限制为内联CSS,它不支持像:before这样的伪元素。

我如何才能实现同样的效果,只使用内联CSS?

您可以指定unicode字符点作为list-style-type属性的值。

例如,Unicode字符"THUMBS UP SIGN"(U+1F44D(可以这样使用:

<p>My custom list</p>
<!-- change the unicode character and how far the list is indented here -->
<ul style="list-style-type: '1F44D'; margin-left: 0.5em">
<!-- padding-left is the spacing between the text and the list character -->
<!-- padding-bottom is the vertical spacing between each list item -->
<li style="padding-left: 0.25em; padding-bottom: 0.25em">one</li>
<li style="padding-left: 0.25em; padding-bottom: 0.25em">two</li>
<li style="padding-left: 0.25em; padding-bottom: 0.25em">three</li>
</ul>

最新更新