为什么我被告知要使用< li>以下所示的方式<<<<< [英] Why am i being told to use <li> the way shown below <<<<

查看:92
本文介绍了为什么我被告知要使用< li>以下所示的方式<<<<<的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



正如你可以在第二行< li>所看到的

code>在louis
之后是没有< / li> 的独自一人,我被告知将它关闭到最后,我不明白不幸的是。

第二行和第二行是我在说的。

 < UL> 
< li> Louis<<<
< ol>
< li>路易斯< / li>
< li>路易斯< / li>
< ul>
< li>路易斯< / li>
< li>路易斯< / li>
< ol>
< li>路易斯< / li>
< li>路易斯< / li>
< / ol>
< / ul>
< / ol>
< / li> <<<<
< / ul>


解决方案

我已经格式化了您的代码,继续。所发生的一切就是列表嵌套。



请注意,您发布的代码并非实际有效的HTML。 UL OL 元素只能包含 LI 元素作为子元素。在 OL 内直接嵌套 UL 是不合法的语法。



很可能,您试图在<$ c $内包含 UL OL 元素

 < ul> 
< li> Louis
< ol>
< li>路易斯< / li>
< li> Louis
< ul>
< li>路易斯< / li>
< li> Louis
< ol>
< li>路易斯< / li>
< li>路易斯< / li>
< / ol>
< / li>
< / ul>
< / li>
< / ol>
< / li>
< / ul>

呈现如下:


  • Louis


    1. Louis
    2. Louis

      • Louis

      • 路易斯


        1. 路易

        2. 路易








        3. $ b

          还有一点需要注意:如果您尝试在HTML中包含<<<< < ,请使用& lt;


          I cant seem to find a straight answer on any website really.

          As you can see on line 2 <li> is all alone with no </li> after louis Im being told to close it toward the end, i don't get it sadly.

          Line 2 and the second from the bottem are what I'm talking about.

          <ul>
              <li> Louis <<<<
                  <ol>
                      <li> Louis </li>
                      <li> Louis </li>
                      <ul>
                          <li> Louis </li>
                          <li> Louis </li>
                          <ol>
                              <li> Louis </li>
                              <li> Louis </li>
                          </ol>
                      </ul>
                  </ol>
              </li> <<<<
          </ul>
          

          解决方案

          I have formatted your code to make more clear what is going on. All that is happening is that the lists are nested.

          Please note, however, that the code you have posted is not actually valid HTML. UL and OL elements can only have LI elements as children. Nesting a UL directly inside an OL or vice versa is not valid syntax.

          Most likely, you are trying to include the UL and OL elements inside LI elements, like this:

          <ul>
              <li> Louis
                  <ol>
                      <li> Louis </li>
                      <li> Louis
                          <ul>
                              <li> Louis </li>
                              <li> Louis
                                  <ol>
                                      <li> Louis </li>
                                      <li> Louis </li>
                                  </ol>
                              </li>
                          </ul>
                      </li>
                  </ol>
              </li>
          </ul>
          

          Which renders like this:

          • Louis

            1. Louis
            2. Louis
              • Louis
              • Louis

                1. Louis
                2. Louis

          One more little note: if you try to include <<<< in your HTML, it will break. I assume those were just for illustration in your question. If you want to output a literal < in HTML, use &lt;.

          这篇关于为什么我被告知要使用&lt; li&gt;以下所示的方式&lt;&lt;&lt;&lt;&lt;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆