<htmlstart/>

HTML Elements

HTML elements are the building blocks of every web page.

What is an Element?

An HTML element consists of an opening tag, content, and a closing tag:

<tagname>Content</tagname>

Example:

<p>This is a paragraph.</p>
<h1>This is a heading.</h1>
<strong>This is bold text.</strong>

Self-Closing Elements

Some elements have no content and no closing tag:

<br>        <!-- line break -->
<hr>        <!-- horizontal rule -->
<img src="photo.jpg" alt="A photo">
<input type="text">

Block vs Inline

TypeBehaviorExamples
BlockStarts on a new line, full widthdiv, p, h1, ul, table
InlineFlows within text, takes only needed widthspan, a, strong, em, img
🧩

Test Yourself

4 questions
Q1.What are the two main display types of HTML elements?
Q2.Which of these is a self-closing (void) element?
Q3.What surrounds an element's content?
Q4.Which is a block-level element?