HTML中的错误-红色结尾段落标签

时间:2019-05-26 20:03:24

标签: html css

这是我的第一个网页,结尾标记为红色。

有人可以告诉我我做错了吗?

这是我的代码。它工作正常,但是当我尝试向其中添加一些CSS时,它开始以一种奇怪的方式显示我的文本,因此我认为它的代码中肯定有一些错误。

<body>

  <header>
    <h1><a href="http://epro.motorparks.co.uk/?" title="Engagement Pro">Engagement Pro</a></h1>
  </header>

  <section>
    <h2>Frequently Asked Questions</h2>
    <h3>Below you will find answers to the questions we get asked the most about Engagement Pro.</h3>
    <div>

      <p>
        Managers
        <ul>
          <li>Why can't log in?</li>
          <li>A lead came through with no contact details, how do I remove it?</li>
          <li>I have added a comment to an unlogged lead, why is it not excluded?</li>
          <li>A guest enquired twice, but when I created the enquiry it didn't link to the other one.</li>
          <li>Where do I find leads that are being added in my diary by reception?</li>
        </ul>
      </p>

      <p>
        Sales associates
        <ul>
          <li>Why can't log in?</li>
          <li>Why doesn't the 'Export to Pinnacle' button work?</li>
          <li>Why do I have guests I know nothing about in my diary?</li>
          <li>Is there an easier way to see my diary for today, other han changing the date range?</li>
          <li>When adding an appointment, it doesn't show in my appointments diary</li>
          <li>Why are the postcodes highlighted yellow or green sometimes?</li>
        </ul </p>

        <p>
          Product geniuses
          <ul>
            <li>Why can't log in?</li>
            <li>Why does my video have so little views?</li>
            <li>Why can I not save a video?</li>
          </ul>
        </p>

        <p>For any other questions/suggestions please contact Steven Harris or Andreea Mitel.</p>

  </section>
  <footer>
  </footer>
</body>

2 个答案:

答案 0 :(得分:2)

您必须注意,<ul>元素中不允许使用<p>

答案 1 :(得分:0)

我在您的代码中发现了一些代码错误,并使用HTML注释对其进行了修复。希望现在对您来说一切正常! :)

有一件要记住的事情:ul元素在法律上不允许在p元素内使用。 Here is the reason。在代码中,您还会忘记关闭某些标签/缺少一些结束标签。

<body>

  <header>
    <h1><a href="http://epro.motorparks.co.uk/?" title="Engagement Pro">Engagement Pro</a></h1>
  </header>

  <section>
    <h2>Frequently Asked Questions</h2>
    <h3>Below you will find answers to the questions we get asked the most about Engagement Pro.</h3>
    <div>

      <p>Managers</p>
      <!-- Properly closing <p> -->
      <ul>
        <li>Why can't log in?</li>
        <li>A lead came through with no contact details, how do I remove it?</li>
        <li>I have added a comment to an unlogged lead, why is it not excluded?</li>
        <li>A guest enquired twice, but when I created the enquiry it didn't link to the other one.</li>
        <li>Where do I find leads that are being added in my diary by reception?</li>
      </ul>


      <p>Sales associates</p>
      <!-- Properly closing <p> -->
      <ul>
        <li>Why can't log in?</li>
        <li>Why doesn't the 'Export to Pinnacle' button work?</li>
        <li>Why do I have guests I know nothing about in my diary?</li>
        <li>Is there an easier way to see my diary for today, other han changing the date range?</li>
        <li>When adding an appointment, it doesn't show in my appointments diary</li>
        <li>Why are the postcodes highlighted yellow or green sometimes?</li>
      </ul>
      <!-- <ul> was not properly closed -->

      <p>Product geniuses</p>
      <!-- Properly closing <p> -->
      <ul>
        <li>Why can't log in?</li>
        <li>Why does my video have so little views?</li>
        <li>Why can I not save a video?</li>
      </ul>

      <p>For any other questions/suggestions please contact Steven Harris or Andreea Mitel.</p>
    </div>
    <!-- Closing <div> was missing -->
  </section>
  <footer>
  </footer>
</body>