任务:在“注释”类的任何段落内的有序列表中强调强调的文本。这是我目前所拥有的...
.note>p>ol>em{text-decoration:underline;}
我正在努力让它继续下去。我的代码有什么问题?
***编辑:我也试过这个无济于事:
.note p ol em{text-decoration:underline;}
***edit:这是我用来测试它的 HTML...
<div class = "note">
<p>
Modifiers are sometimes included along with the basic command, inside...
</p>
<table align ="center" border = "3" >
<td>
<p>Three things:
<ol type = "i">
<li><em>First</em></li>
<li>Second</li>
<li>Third</li>
</ol>
</p>
</td>
</table>
</div>
最佳答案
你不能,因为 HTML 无效。 OL 不能是 P 的 child 。
http://www.w3.org/TR/html-markup/p.html
A p element’s end tag may be omitted if the p element is immediately followed by an address, article, aside, blockquote, dir, div, dl, fieldset, footer, form, h1, h2, h3, h4, h5, h6, header, hr, menu, nav, ol, p, pre, section, table, or ul element, or if there is no more content in the parent element and the parent element is not an a element.
所以
<p class="note">
<ol>
<li>One</li>
<li><em>Two</em></li>
<li>Three</li>
<li>Four</li>
</ol>
和
<p class="note"></p>
<ol>
<li>One</li>
<li><em>Two</em></li>
<li>Three</li>
<li>Four</li>
</ol>
基本相同
关于html - CSS 继承 : parents and childrens' children,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16611966/