TOC

This article is currently in the process of being translated into Arabic (~7% done).

Introduction to HTML:

The Structure of HTML

قبل استخدام لغة HTML، من المهم فهم كيفية بناء صفحات HTML.

HTML Elements

تتكون لغة HTML من عناصر Eelemnts - تقوم هذه العناصر بدور الترميز للنص كما في المثال في الاسفل:

<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.

Empty Elements

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:

<br />

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. (As I said before, the tag consists of an abbreviation and in this case br stands for break).

Tip!

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, such as these:

<BR />
<bR />
<Br />
<br />

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

  • 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

This article has been fully translated into the following languages: Is your preferred language not on the list? Click here to help us translate this article into your language!
adplus-dvertising