gpt4 book ai didi

html - 修改 HTML 中的列表标题

转载 作者:太空宇宙 更新时间:2023-11-04 13:25:31 25 4
gpt4 key购买 nike

<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>

<ul>
<li>Interests
<ol>
<li style="color: orange">Basketball</li>
<li>Coding</li>
<li>Weight Lifting</li>
</ol>
</li>
<li>Jobs
<ul>
<li>Tutor</li>
<li>Salon Associate</li>
</ul>
</li>
</body>
</html>

如何修改“兴趣”(例如更改其字体颜色)而不同时修改它作为标题的有序列表?

最佳答案

这里不需要类或包装:

演示:http://jsfiddle.net/abhitalks/jgbX7/

li { /* reset all list items */
color: black;
}
:not(li) > ul > li { /* all "li" under "ul" which are not under "li" */
color: red;
}

但是,当然,如果您有多个这样的列表,那么为顶部 ul 提供一个类会有所帮助。

关于html - 修改 HTML 中的列表标题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23752628/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com