Please explain the difference between these two sets of code

No it’s only doing one thing. It’s adding a closing tag.

The browser doesn’t add a backslash to your opening list tag! The browser sees 2 opening list tags which are allowed and just closes them. It does not create any new list items. You did that by forgetting the backslash.

6 Likes

okay the browser sees this as two opening list tags and therefore appends two closing tags corresponding to each opening li tag and as the second opening tag has no item inside it thats why it is blank.
ok

1 Like

That’s because they are two opening list tags.

5 Likes

One should NOT write html with the assumption that all browsers will apply opening or closing element tags by default (even if allowed). As Paul said above…

Formal rules. If you write your code the way the formal rules expect it to be written, then the web page will be displayed the way you intend for it to be displayed in all browsers (that follow the rules). Don’t depend on all browsers to correctly display malformed code.

repeating…
PLEASE indent your code uniformly (4 spaces is common, 20 spaces is excessive) and delete empty lines (like the lines in a novel). The code becomes much easier for everyone to read including you.

5 Likes

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.