HTML Elements
The HTML element is everything from the start tag to the end tag:
HTML elements are the building blocks of HTML pages. They define the structure and content of a webpage. An HTML element typically consists of a start tag, content, and an end tag.
Basic structure of an HTML Elements:
- Start Tag: The opening part of the element, e.g., <tagname>
- Content: The actual content enclosed within the tags, e.g., text, images, or other elements.
- End Tag: The closing part of the element, e.g., </tagname>.
Common HTML Elements:
- 1. Headings: <h1> to <h6> tags, with <h1> being the highest(or most important) level, and <h6> the lowest.
- 2. Paragraph: <p> tag is used to define a paragraph.
- 3. Links: <a> tag is used to create hyperlinks.
- 4. Images: <img> tag is used to embed images. This is a self-closing tag, meaning it doesn’t have a separate end tag.
-
5. Lists:
- Unordered Lists:<ul> for lists with bullet points.
- Ordered Lists:<ol> for lists with numbered items.
- List Items:<li> for each item in the list.
- 6. Divisions: <div> is a block-level element used to group other elements.
- 7. Spans: <span> is an inline element used to group small parts of text for styling.
Nesting Elements
HTML elements can be nested within each other. For example, a paragraph (<p>) may contain text as well as other inline elements like <a> for links.
Empty HTML Elements
HTML elements with no content are called empty elements.
HTML is Not Case Sensitive
HTML tags are not case sensitive: <B> means the same as <b>.
Key Points
- HTML elements are the building blocks of a webpage.
- Each element is represented by a tag, usually enclosed in angle brackets.
- Elements can be nested within each other to create complex structures.
- HTML elements form a tree-like structure known as the DOM.