Click here to Skip to main content
15,891,841 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
HTML
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8" />

  <title>Company page</title>
</head>

<body>
  <a>Welcome! Here you can find following things:</a>
 
  <em><ol>
    <li><a href="#logo">Company's logo</a></em></li>

    <li><a href="#employees">List of employees</a></em></li>
  </ol></em>

  <h1>Company's logo </h1>
  <a>Company uses following logos:</a>

  <ul>
    <li>New logo:<img src="new_logo.gif" alt="404 Not found" /></li>

    <li>Old logo:<img src="old_logo.gif" alt="404 Not found" /></li> 
  </ul>
    <input type="number" name="name" value=""/><br/>

  <h1>List of employees</h1>

  <table>
    <thead>
      <tr>
        <th>First name</th>

        <th>Last name</th>
      </tr>
    </thead>
    <tbody>
    
   
    <tr>
      <td>Mary</td>

      <td>Williams</td>
    </tr>

    <tr>
      <td>James</td>

      <td>Smith</td>
    </tr>

    <tr><td>me</td><td></td></tr>

      </tbody>
    
  </table>
</table><a href="google" target="new window"><div>click me</div></a>
</body>
</html>


What I have tried:

In line 12, I try to use "<em>" with "<ol>" but it's show an error.

Quote:
Error: Element ol not allowed as child of element em in this context. (Suppressing further errors from this subtree.)


HTML
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8" />

  <title>Company page</title>
</head>

<body>
  <a>Welcome! Here you can find following things:</a>
 
  <em><ol>
    <li><a href="#logo">Company's logo</a></em></li>

    <li><a href="#employees">List of employees</a></em></li>
  </ol></em>

  <h1>Company's logo </h1>
  <a>Company uses following logos:</a>

  <ul>
    <li>New logo:<img src="new_logo.gif" alt="404 Not found" /></li>

    <li>Old logo:<img src="old_logo.gif" alt="404 Not found" /></li> 
  </ul>
    <input type="number" name="name" value=""/><br/>

  <h1>List of employees</h1>

  <table>
    <thead>
      <tr>
        <th>First name</th>

        <th>Last name</th>
      </tr>
    </thead>
    <tbody>
    
   
    <tr>
      <td>Mary</td>

      <td>Williams</td>
    </tr>

    <tr>
      <td>James</td>

      <td>Smith</td>
    </tr>

    <tr><td>me</td><td></td></tr>

      </tbody>
    
  </table>
</table><a href="google" target="new window"><div>click me</div></a>
</body>
</html>
Posted
Updated 29-Mar-17 7:08am
v6

1 solution

Do you know what an em element is?

What you need to use is, you need to set em as the child for li elements. The view is the same, but is legal. Like this,
<ol>
    <li><em><a href="#logo">Company's logo</a></em></li>
    <li><em><a href="#employees">List of employees</a></em></li>
</ol>
This is what you want to use. This would render what you want it to. Plus, it won't show the errors.

One more thing, every element in HTML has a reason, semantic, that you need to follow. If you ever get confused as to whether an element can be a possible child of an element, go to MDN documentation and see for yourself, <em> - HTML | MDN[^]
 
Share this answer
 
Comments
Member 13064822 17-Mar-17 5:32am    
Thanks a lot ^_^

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900