HTML5 中的两个'h2'标头



我的类被要求使用HTML5而不是CSS创建此网页。

问题:我有两个H2,我在某个地方读到这是合法的和两组"无序列表",但它们没有排队。我的意思是彼此衬里:示例困惑 AAA BBB CCC冷静的 ABC BCA BAC他们正在排队(?)。平静的标题&它的列表更正确。我已经研究了几个网站,但还没有想到为什么会发生这种情况。感谢您的帮助和见识。

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>Serenity</title>
    <style type="text/css">
    body 
        {
                background-image:url("images/bg-ocean-body.jpg");
                background-repeat:no-repeat;
                background-size: cover;
            }
    </style>
        <h1 span style="text-align:center; color:green;">Achieving Calm Amid<span style="color:black"> Confusion</h1>
         <h2>Confusion</h2>
         <ul>
            <li>Government Shutdown</li>
            <li>"do nothing" congress</li>
            <li>bridgegate, sandygate</li>
            <li>Putin, Sochi</li>
        <h2 span style="color: green; text-align:left;">Calm</h2>
        <ul>
            <li>wipe away stress</li>
            <li>gain mental/emotional balance</li>
            <li>anxiety decreases</li>
            <li>develop perspective</li> 
        </ul>
</head> 
</html>

您在错误的位置添加<span>标签。<span>是一个单独的标签,而不是<h2>的属性。

例如,您几乎在混淆上几乎正确使用<span>,但是您没有使用</span>关闭它。

我相信您想做的事情:

<h1><span style="text-align:center; color:green;">Achieving Calm Amid</span><span style="color:black"> Confusion</span></h1>

另外,您需要使用</ul>关闭第一个<ul>标签。

最新更新