What is HTML?
HTML (Hypertext Markup Language) is a descriptive language used to mark specific parts of web page content (known as a markup language).
Who uses these content tags?
These content tags are used by browsers. When a browser “sees” the appropriate HTML tag, it understands what type of content it is dealing with (whether it’s an image, text, etc.) and how it should display it on the page.
HTML Syntax
HTML uses special markers called tags to define content. These tags are actually words enclosed within angle brackets
< >.
For a tag to be valid, only specific, predefined words can be used, because those words tell the browser how to interpret and display the content. Most tags come in pairs: an opening tag and a closing tag, with the content they describe placed in between.
An opening tag looks like this:
<tagName>
A closing tag has an additional slash:
</tagName>
Example:
<h1>This is an example of an "h1" tag used for main headings</h1>
As mentioned, most tags have both opening and closing versions. However, some tags do not have a closing tag, while others may not have an opening tag. One such example is the “break” tag, which moves text to a new line: <br>
The Structure of an HTML Page
HTML Declaration
At the very top of an HTML file (web page), there is always a declaration that tells the browser this is an HTML document: <!doctype html>
The HTML Element
After declaring that the document is HTML, we must define the boundaries where the HTML code will reside. These are marked by the opening <html> and closing </html> tags.
Example:
1 |
<!doctype html> <html> </html> |
Head & Body
Everything written within the
<html> tag is divided into two parts: – The <head> section, which contains information important for the browser (we will explain this later). – The <body> section, which contains all the content that will actually be visible on the web page.
Example:
1 |
<!doctype html> <html> <head> </head> <body> </body> </html> |
Check out the most commonly used HTML tags in the article: “Basic HTML Tags”