Introduction to HTML
HTML Tutorials
What is HTML?
- HTML stands for HyperText Markup Language. It’s the standard markup language used to create and structure content on the web.HTML uses a set of tags to define the structure and elements of a webpage.
- An HTML document consists of nested elements. The basic structure includes a
<!DOCTYPE>
declaration,<html>
tag,<head>
section, and<body>
section.
Structure of an HTML Document
- HTML Tags and Elements
- Tags are used to define elements in HTML.
- An HTML element consists of an opening tag, content, and a closing tag (e.g.,
<tag>content</tag>
). - Commonly used tags include headings (
<h1>
to<h6>
), paragraphs (<p>
), and line breaks (<br>
).
- HTML Comments
- You can add comments in HTML to annotate your code.
- Comments are not displayed in the browser but are helpful for documentation.
- Whitespace and Indentation
- HTML doesn’t care about extra whitespace, but consistent indentation improves code readability.
- Use spaces or tabs to indent your code consistently.
- HTML Attributes
- Attributes provide additional information about elements.
- They are placed within the opening tag and modify the element’s behaviour or appearance.
- Basic HTML Document Example
- A simple example demonstrating the structure of an HTML document.
- Includes the
<html>
,<head>
, and<body>
sections.
- Viewing HTML in a Browser
- How to view HTML documents in a web browser.
- Browsers render the HTML content and display it visually.