4.19. Introduction to HTML: basic structure, tags and attributes: Box Model

HTML, which stands for HyperText Markup Language, is the standard markup language for creating web pages and applications. Along with CSS and JavaScript, HTML is a fundamental technology used by most websites to create visually appealing web pages, user interfaces for web applications, and user interfaces for many mobile applications.

Basic Structure of HTML

An HTML document is structured like a book - it has a header and a body. The header, contained within the <head> tags, typically contains meta information about the document, including the title that is displayed in the browser's title bar. The body, contained within the <body> tags, contains the main content of the HTML document.

At a more detailed level, the basic structure of an HTML document consists of nested HTML elements. An HTML element is defined by a start tag, some content, and an end tag. For example, a paragraph, which is represented by the <p> tag, can be written as follows: <p>This is a paragraph.</p>.

HTML Tags and Attributes

HTML tags indicate the type of element being inserted, such as a heading (<h1> to <h6>), a paragraph (<p>), a list (<ul> or <ol> with list items <li>) or a link (<a> ).

HTML attributes provide additional information about elements. They come in name and value pairs and are placed inside the element's start tag. For example, the link element has a href attribute that indicates the URL the link leads to: <a href="https://www.example.com">This is a link</a>.

Box Model

In web design, a box model is a box that surrounds each HTML element. It consists of margins, borders, padding, and the actual content. This template allows developers to control the layout and positioning of HTML elements on a page.

  • Content: This is the area where text and images appear.
  • Padding: This is the area around the content, inside the border. Padding increases the size of the box.
  • Border: This is the area outside the padding. The border surrounds the padding and content.
  • Margin: This is the area outside the border. The margin is transparent and separates the box from the surrounding boxes.

Understanding the box model is crucial to being able to create complex and responsive layouts. It is the basis of almost all CSS design and is one of the fundamental concepts for understanding how CSS works.

In conclusion, HTML is an essential markup language for web development. It allows developers to create complex and meaningful structures with their tags and attributes, while the box model allows precise control over the layout and design. Understanding these concepts is the first step to becoming a proficient front-end developer.

Now answer the exercise about the content:

What is the Box Model in web design?

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

You missed! Try again.

Article image Introduction to HTML: basic structure, tags and attributes: Positioning in CSS

Next page of the Free Ebook:

24Introduction to HTML: basic structure, tags and attributes: Positioning in CSS

4 minutes

Obtenez votre certificat pour ce cours gratuitement ! en téléchargeant lapplication Cursa et en lisant lebook qui sy trouve. Disponible sur Google Play ou 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