Learn HTML 5 – Structure of HTML
Before starting to use HTML it is important that you understand the structure of HTML. As HTML is a markup language, you use it to mark up different parts of your content – kind of like when you are using a highlighter.
HTML is constructed of elements and it is these elements you use to do your markup. Below is an example of how you could mark up a regular text-paragraph.
<p>This paragraph is part of my content</p>
What we have here is a sentence (”This paragraph is part of my content”) which have been placed between <p> and </p>. The <p> and the </p> is called tags. Every tag consists of a <, an abbreviation, and a >. In this case, p is an abbreviation for paragraph. Combined, the <p> and the </p> tags create an element. Every HTML-element starts with an opening tag (in this case, that is <p>) and most have a closing tag (that is </p>). Inside the opening and the closing tag of your element is the actual content.
Most HTML-elements looks like the <p></p> element, but some are what we call empty elements. The line-break element is such one and looks like this:
As you can see, there is no closing tag and the element do not contain any content, therefore it is called an empty element. Because this is an empty element it is closed at the end of the tag – that’s the /. You don’t have to use the ”/” at the end of an empty element, but it is considered good practice, so you might as well get used to it.
When the browsers read your HTML5 document they don’t care whether or not you write your tags in uppercase or lower case. But other developers do! Even though you could write the same linebreak-tag in a lot of different ways
It is considered good practice to write all your tags in lowercase – in increases readability, and it is just considered good craftsmanship to write your tags this way.
What you have learned so far:
- An HTML element starts with a opening tag
- An HTML element ends with a closing tag
- A HTML tag starts with a < and ends with a >
- The letters between the < and > are abbreviations
- The element content is everything between the start tag and the end tag
- Some HTML elements are empty
- Empty elements are closed in the start tag
- Make it a habbit to type all your tags in lowercase – it is considered good practice