无法在子列表中删除直通 [英] Line through cannot be removed in sublist
问题描述
以下代码显示有两个嵌套列表。外部一个与text-decoration:line-through属性和其他没有通过。我如何删除这个内线通过或不应用它在第一?我想在外部而不是内部一词上进行换行。
The following code show have two nested lists. The outer one with text-decoration:line-through property and the other with no line through. How can I remove this inner line-through or not apply it in the first place?!! I want line-through on the word "outer" but not "inner"
<DOCTYPE html>
<header><style>
ol li {text-decoration:line-through; color:red;}
ol li ul li{text-decoration:none; color:pink;}
</style></header>
<body>
<ol>
<li>Outter
<ul>
<li>
Inner
</li>
</ul>
</li>
</ol>
</body>
推荐答案
inline-block ,以避免父母的 text-decoration
影响其子女。
You can use display: inline-block
to avoid parent's text-decoration
affecting its children.
,根据规格,
当指定或传播到
inline元素时,它会影响由该元素生成的所有框,
,并进一步传播到任何流入的块级别框,将
拆分为内联(参见第9.2.1.1节)。但是,在CSS 2.1中,它是未定义
装饰是否传播到块级表。对于建立内联格式化上下文的块
容器,
装饰传播到一个匿名内联元素,该元素包装块容器的所有in-flow内联级子级的
。对于所有
其他元素,它被传播到任何流的孩子。请注意,
文本装饰不会传播到浮动,绝对
定位后代,也不会传递到原子内联级别的内容
后代,例如内联块和内联表。
这篇关于无法在子列表中删除直通的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!