Structure web pages with HTML
HTML and its uses
HTML (HyperText Markup Language) is a markup language and the most basic building block of the Web. It is used to define the meaning and structure of web content.
- We use HTML because it adds “markup” to text, images, and other content so that web browsers can display them correctly.
- The “Hypertext” part refers to links that connect web pages within a website or between different websites. This is a key part of how the Web works.
3 main parts of an HTML element
The main parts that make up an HTML structure include:
- Elements, which are created using tags.
The element name (for example, title) is surrounded by < and >.
- Attributes, which add extra details to an element.
- Content, which is the text or media placed between the tags.
When you give an element extra information, it is called an attribute. Attributes change how an element behaves or looks.
Semantic element
A semantic element is an HTML element where the meaning or purpose is clear from the element itself, not just its appearance.
- For example, the
<h1> element is semantic because it marks the text as a “top-level heading.”
Using semantic markup gives several benefits:
- SEO: Search engines treat content inside semantic elements as important.
- Accessibility: Screen readers use semantic elements to help visually impaired users navigate the page.
- Cleaner Code: Developers can quickly find meaningful sections of code.
- Clear Purpose: The element tells what kind of content should go inside it.