html - CSS 继承 : parents and childrens' children

标签 html css inheritance

任务:在“注释”类的任何段落内的有序列表中强调强调的文本。这是我目前所拥有的...

.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/

相关文章:

javascript - 将文本附加到 slider 文本 (display_selector)

javascript - 选项选定值不起作用

html - 有什么想法可以让我的 html 页面看起来更好吗?

javascript - asp.net 在单击按钮时滚动到 anchor

inheritance - 如何在 Dart 中扩展 Rectangle 类?

C# Interfaces——只在其他接口(interface)中实现一个接口(interface)

java - 虽然我已经为对象属性定义了值,但是它们都变成了 null?为什么?

html - 多模态框 - 纯 CSS

Chrome、FF、IE 高度滚动上的 Javascript 事件(添加样式)

css - 试图获取 section.class1 而不是 section.class1,scss