Avoid omitting <html> and <body> tags
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.
From Lesson
HTML Dos and Don'ts