Basics
HTML Syntax
HTML Syntax Fundamentals
HTML syntax uses tags like <p> and attributes, with case-insensitive elements.
Understanding HTML Tags
HTML (HyperText Markup Language) uses a system of tags to define the structure and content of a web page. Tags are the basic building blocks of HTML and are enclosed in angle brackets, e.g., <p> for a paragraph.
Most HTML tags come in pairs: an opening tag and a closing tag. The closing tag is preceded by a forward slash, for example, <h1> and </h1> for a first-level heading.
Using Attributes in HTML
Attributes provide additional information about HTML elements. They are always included in the opening tag and are specified as name-value pairs. The href attribute in the <a> tag is commonly used to define a hyperlink.
Case Insensitivity of HTML Elements
HTML elements are case-insensitive, which means <div>, <DIV>, and <Div> are interpreted in the same way by browsers. However, it is a common practice to use lowercase for consistency and readability.
Self-Closing Tags
Some HTML tags are self-closing, meaning they do not have a separate closing tag. These typically represent empty elements and are written with a slash at the end of the opening tag. Examples include <br /> for a line break and <img /> for an image.
Basics
- Previous
- Introduction
- Next
- Doctype