Avoid omitting <html> and <body> tags

Avoid omitting <html> and <body> tags Bad Practice
Avoid omitting <html> and <body> tags Best Practice

The <html> and <body> elements are essential, but the browser will handle it and still render your page if you skip them. So then why does the W3C strongly recommend adding those elements? Firstly, omitting <body> can cause errors in older browsers.

Secondly, developers use the <html> element to specify the page language, which is important for accessibility applications like screen readers and search engines. The syntax will look like this: <html lang="en-US">. The tags also maintain readability and consistency.

<?xml version="1.0" encoding="utf-8"?>