Free Ebook cover Complete HTML, CSS and Javascript course to become a Front End Developer

Complete HTML, CSS and Javascript course to become a Front End Developer

3.79

(14)

125 pages

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

Capítulo 7

Estimated reading time: 4 minutes

Audio Icon

Listen in audio

0:00 / 0:00

Introduction to HTML: Basic Structure, Tags and Attributes

HTML, or HyperText Markup Language, is the standard markup language for creating web pages and applications. Understanding the basic structure of HTML, as well as tags and attributes, is critical for any front-end developer. In this chapter, we will explore these concepts in detail.

Basic structure of HTML

An HTML document is made up of HTML elements, which are indicated by tags. Each HTML document begins with the document type declaration , which tells the browser that the document is an HTML5 file. The tag <html> that involves the entire content of the page.

<!DOCTYPE html>
<html>
...
</html>

Within the <html> tag, we have two main parts: the <head> and <body>. The <head> contains metadata about the document, such as the page title (<title> tag), links to CSS stylesheets (<link> tag), and JavaScript scripts (<script> tag). The <body> contains the actual content of the page that is visible to users.

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

HTML Tags

HTML tags are used to define elements in an HTML document. They are surrounded by angle brackets (< and >). Most tags come in pairs and wrap around the content they are affecting. For example, the <p> is used to create a paragraph:

<p>This is a paragraph.</p>

There are many HTML tags, each with its own purpose. Some of the most common include <h1> to <h6> for headers, <a> for links, <img> for images, <ul> and <li> for lists, and <div> and <span> to group elements.

Continue in our app.

You can listen to the audiobook with the screen off, receive a free certificate for this course, and also have access to 5,000 other free online courses.

Or continue reading below...
Download App

Download the app

HTML Attributes

HTML attributes are used to provide additional information about an element. They are always specified at the beginning of the opening tag and usually come in name/value pairs. For example, the <a> generally uses the href attribute to specify the link URL:

<a href="https://www.example.com">This is a link</a>

Other common attributes include src to specify the font of an image, alt to specify alternative text for an image, and style to add CSS styles to an element.

In short, HTML is the backbone of any web page. Understanding the basic structure of HTML, as well as tags and attributes, is the first step to becoming an effective front-end developer. In the next chapter, we will explore CSS and how it is used to style HTML elements.

Now answer the exercise about the content:

What is the function of the <head> in an HTML document?

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

You missed! Try again.

The element in an HTML document contains metadata about the document, such as the page title, links to CSS stylesheets, and JavaScript scripts. This information is generally not displayed on the page itself but is crucial for the page's proper functioning and SEO performance.

Next chapter

Introduction to HTML: basic structure, tags and attributes: Attributes in HTML

Arrow Right Icon
Download the app to earn free Certification and listen to the courses in the background, even with the screen off.