4.2. Introduction to HTML: basic structure, tags and attributes: Basic structure of HTML

Página 6

HTML, which stands for Hyper Text Markup Language, is the standard markup language for creating web pages and applications. It is one of the main tools that any front-end developer must master. This module of our e-book course will introduce the basic structure of HTML, its tags and attributes.

Basic structure of HTML

An HTML document is made up of a series of elements, each represented by a tag. The basic structure of an HTML document looks like this:

<!DOCTYPE html>
<html>
<head>
  <title>Page title</title>
</head>
<body>
  Page content goes here.
</body>
</html>

The <!DOCTYPE html> at the beginning of the document is a declaration that tells the browser that this is an HTML5 document. The <html> involves the entire content of the page. Within this tag, we have two other important tags: <head> and <body>.

The <head> contains information about the page that is not visible to the user, such as the page title (which appears in the browser's title bar) and links to external CSS and JavaScript files. The <body> contains all the content that the user sees, such as text, images, links, etc.

HTML Tags

HTML tags are the foundation of any web page. They define the structure and layout of the page, and can be used to add text, images, links and other elements. Here are some of the most common tags:

  • <h1> a <h6>: These tags are used to add titles and subtitles. <h1> is the most important title (and usually the largest in size), while <h6> is the least important.
  • <p>: This tag is used to add paragraphs of text.
  • <a>: This tag is used to add links.
  • <img>: This tag is used to add images.
  • <div>: This tag is used to group other elements.

HTML Attributes

HTML attributes are used to provide additional information about an element. They are always specified at the beginning of the tag and have the following structure: attribute_name="attribute_value". Here are some of the most common attributes:

  • class: This attribute is used to specify one or more classes for an element. Classes are used to select elements with CSS and JavaScript.
  • id: This attribute is used to specify a unique identifier for an element. The id must be unique within the document.
  • src: This attribute is used to specify the source of a media element, such as an image or video.
  • href: This attribute is used to specify the URL of a link.
  • alt: This attribute is used to specify alternative text for an image, which will be displayed if the image cannot be loaded.

In short, HTML is the backbone of any web page. Mastering the basic structure of HTML, its tags and attributes is essential for any front-end developer. In the next module of our e-book course, we will explore CSS, the language used to style HTML pages and create attractive, responsive layouts.

Now answer the exercise about the content:

What does the <head> in HTML contains?

You are right! Congratulations, now go to the next page

You missed! Try again.

Next page of the Free Ebook:

74.3. Introduction to HTML: basic structure, tags and attributes: Understanding HTML tags

Earn your Certificate for this Course for Free! by downloading the Cursa app and reading the ebook there. Available on Google Play or App Store!

Get it on Google Play Get it on App Store

+ 6.5 million
students

Free and Valid
Certificate with QR Code

48 thousand free
exercises

4.8/5 rating in
app stores

Free courses in
video, audio and text