The Structure of HTML – A Guide, with Code Examples
The structure of HTML has to be properly followed and maintained for a web browser to correctly read the HTML document. Without its structure and proper syntax, errors can easily cause browsers to show broken pages to the end user.
HTML is found extensively across all websites on the world wide web, indeed it was created and designed specifically for this purpose. Whether you’re browsing Facebook, or learning how to buy and sell crypto on eToro; what’s in front of you will actually be structured HTML.
The Structure of HTML – How HTML is structured
HTML is structured by using HTML elements, which enclose the content intended for the user. These HTML elements each describe or identify a purpose for their content, be it to state that a certain portion of the web page is a paragraph or that there is an image placed at this point in a web page.
The elements themselves comprise of HTML tags, markup contained within angled brackets.
For example, the element to denote an HTML document itself might be written <!DOCTYPE html>.
The Structure of HTML – HTML Tag Pairs
HTML tags most commonly come in pairs, for example <p> and </p> which enclose a paragraph. However some HTML tags can be found on their own, these are commonly known as empty elements and are unpaired, an example being the <img> tag for an image element.
The terms tag and element are often used interchangeably by web designers, however by definition; an HTML element comprises the opening tag, closing tag (if paired) AND any web page content enclosed between them.
The Structure of HTML – Where to next?
If you’re interested in learning more, then our guide on The Structure of CSS is a great next step.
If you want to start building new websites, blogs or eCommerce stores, then we’d recommend that you check out ToolsToBuildWith.com