Justin Young
Justin Young

Reputation: 11

Multiple <html> blocks in a single file?

I'm working on a web project, and I was wondering if I could format a webpage by placing two (or more) html blocks one after another. Does this cause any side-effects? Will it potentially cause problems on mobile? Thanks!

Upvotes: 1

Views: 1244

Answers (2)

Sandeep
Sandeep

Reputation: 148

The <html> tag tells the browser that this is an HTML document.
The <html> tag represents the root of an HTML document.
The <html> tag is the container for all other HTML elements (except for the <!DOCTYPE> tag).

Therefore, having multiple <html> tags leads to ambiguity which eventually makes HTML document invalid.

Upvotes: 2

Jeremy McArthur
Jeremy McArthur

Reputation: 83

No you should not have more than one HTML tag in your file. With multiple tags it becomes an invalid document and will often times not display properly.

Note: You should only have one body tag as well. It is best practice to make each new page a new HTML file, but have all CSS on one file separate from the HTML.

Upvotes: -1

Related Questions