Skip to content

HTML file structure and how to write HTML in the editor

  • by

In this post we will learn about the structure of an HTML file and how to write HTML on the editor, but before we begin we would like to welcome our dear visitors, thank you.

HTML file structure:

An HTML file consists of an opening tag and a closing tag. The content is written between these two tags. The difference between the opening and closing tags is that the closing tag contains a slash (/).

For example: <tag> is an opening tag, <tag/> is a closing tag.

Note: Some HTML elements are exceptions; they do not have a closing tag and are closed by a slash (/) after the element name, for example, </tag>.

Element html:

<html>: This is the top element of the document, so all other elements must be written inside this element.

Element head:

<head>: The head element contains machine-readable information, such as the page title, CSS formatting, external CSS file links, JavaScript file links, and other links that will be explained in this course.

Element body:

<body>: The body element contains the content of an HTML page; in other words, it’s responsible for the content displayed to the user in the browser.

For example, if the <p>Welcome to our website<p/> element is written, and then this page is displayed in the browser, only the text (Welcome to our website) is displayed.

Element DOCTYPE:

<DOCTYPE html!>: It is an element that prevents the browser from evading the document display; in other words, when you include this element at the top of an HTML page, it ensures that the browser does its best to follow the relevant specifications.

Note:

These elements are considered the most important elements in HTML, and you cannot repeat this element on the same page. That is, if you write it on the page, you cannot rewrite it again on the same page.

How to write HTML in the editor:

<DOCTYPE html!>
<html>
<head>
</head>
<body>
</body>
</html>

Leave a Reply

Your email address will not be published. Required fields are marked *