DEV Community

Cover image for HTML structure for Beginners
Jemima M
Jemima M

Posted on

HTML structure for Beginners

HTML (Hypertext Markup Language) is a markup language (computer language that consists of easily understood keywords, names or tags) for creating webpages. HTML has an overall simple structure but contains many elements and these elements tell the browser how to display the content. Examples of HTML elements are <h1> or <p> but we will get onto these another time, for now we want to focus on the basic HTML document.

Basic HTML Document

<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>

<h1>My First Heading</h1>
<p>My first paragraph.</p>

</body>
</html>
Enter fullscreen mode Exit fullscreen mode
  • The first line of code <!DOCTYPE html> confirms that it is an HTML5 document.

  • The second line of code <html> is the root element of the html page.

  • The third line of code <head> is the element which contains meta information about the page. Meta information is used to provide additional information about a page to search engines and clients.

  • The fourth line of code <title> is the element which is known as the title of the page. This will also show up in the browsers bar.

  • The sixth line of code <body> establishes the documents body, and it contains all of the visible content such as the headings, images, paragraphs etc...

  • The eighth line of code <h1> is the heading element. Heading elements go from <h1> up to <h6>. Use the heading element when you want to form a heading on the page.

  • The ninth line of code <p> is the paragraph element and this interprets a paragraph. Use the paragraph element when you want to build a paragraph.

This is the very basics of a HTML document explained and the more you code, the more you will understand the structure of HTML and the elements involved.

I hope this blog has helped and thank you for reading 😁

Keep Coding!

Top comments (0)