An HTML element is defined by a start tag, some content, and an end tag. HTML Elements The HTML element is everything from the start tag to the end tag: < tagname > Content goes here... < /tagname > Examples of some HTML elements: < h1 > My First Heading < /h1 > < p > My first paragraph. < /p > Nested HTML Elements HTML elements can be nested (this means that elements can contain other elements). All HTML documents consist of nested HTML elements. The following example contains four HTML elements ( <html> , <body> , <h1> and <p> ): Example < !DOCTYPE html > < html > < body > < h1 > My First Heading < /h1 > < p > My first paragraph. < /p > < /body > < /html > Example Explained The <html> element is the root element and it defines the whole HTML document. It has a start tag <html> and an end t...
HTML Documents All HTML documents must start with a document type declaration: <!DOCTYPE html> . The HTML document itself begins with <html> and ends with </html> . The visible part of the HTML document is between <body> and </body> . Example < !DOCTYPE html > < html > < body > < h1 > My First Heading < /h1 > < p > My first paragraph. < /p > < /body > < /html > The <!DOCTYPE> Declaration The <!DOCTYPE> declaration represents the document type, and helps browsers to display web pages correctly. It must only appear once, at the top of the page (before any HTML tags). The <!DOCTYPE> declaration is not case sensitive. The <!DOCTYPE> declaration for HTML5 is: < !DOCTYPE html > HTML Headings HTML headings are defined with the <h1> to <h6> tags. <h...