What does <!doctype html> do?

后端 未结 6 437
面向向阳花
面向向阳花 2020-12-12 19:06

What does this tag do?

What I can see is that with this tag on top my html behaves in another way than without. How do I k

6条回答
  •  不思量自难忘°
    2020-12-12 19:43

    It's an integral part of HTML as defined in the specification:

    8.1.1 The DOCTYPE

    A DOCTYPE is a required preamble.

    DOCTYPEs are required for legacy reasons. When omitted, browsers tend to use a different rendering mode that is incompatible with some specifications. Including the DOCTYPE in a document ensures that the browser makes a best-effort attempt at following the relevant specifications.


    Edit to add:

    What does this seatbelt do?

    Seatbelt image

    What I can see is that, with this seatbelt on, my car behaves the same way as without. How do I know if I need this seatbelt?

    You wont know if you'll need it until something goes wrong and you don't have it.

提交回复
热议问题