Nearby lessons
2 of 24π¦ HTML Elements
π― What is an HTML Element?
An HTML element is made of a <start-tag>, some content, and an </end-tag>.
It tells the browser how to display content like text, images, links, and more.
<tagname>Content goes here</tagname>
Example: <p>Hello</p> is a paragraph element that shows "Hello" on the page.
π€ Basic HTML Element Example
Every HTML page starts with basic elements like <html>, <head>, and <body>.
The <p> tag is used for paragraphs and is one of the most common elements.
Code Example
π« Empty HTML Elements
Some elements donβt need a closing tag or content. These are called empty elements.
They are self-closing and often used for layout and spacing.
Example: <br> adds a line break. <img> is used to display an image.
Code Example
π Nested HTML Elements
HTML elements can be nested, which means one element can be placed inside another.
This allows building a proper page structure like sections, headers, and containers.
Example: A <div> may contain a <h1> and <p> together.