Junior JavaScript

What is the purpose of the <!DOCTYPE html> declaration?

The <!DOCTYPE html> declaration tells the browser which version of HTML the page

uses.

In modern websites, it triggers HTML5 standards mode, ensuring consistent rendering

across browsers.

Example:

<!DOCTYPE html>

<html>

...

</html>

Key Takeaway:

Always include <!DOCTYPE html> at the top of every HTML file.

More from JavaScript Tutorial

All questions for this course