HTML Building Blocks for Beginners (With Examples)
Types of Tags:
Types Of Elements:
1. Block-level Elements – Block-level elements takes up the full width of the screen or webpage another element start ‘s on a new line. It can contain other block-level and inline elements.
Example:
<div>This is a div</div>
<p>This is a paragraph</p>
<h1>This is a heading</h1>
<ul>
<li>List Item</li>
</ul>

Behavior:
They stack vertically, each on a new line.Here we have given background color as black it fills the whole width of the screen.
2.Inline Elements: Inline-elements take only space/width as the content fits.They do not start on a new line unless it’s a block element. It cannot contain block-level elements (but can contain other inline elements or text).
Example:
<span>This is a span</span>
<strong>This is bold text</strong>
<img src=”image.jpg” alt=”An image”>

Behavior:
They stay in the same line and sit next to each other unless the line is too narrow.
3.Inline-Block Elements
They behave like inline elements (sit on the same line), but you can set width, height, padding, and margins like a block-level element.
For Example:
<div style=”display: inline-block; width: 100px; height: 50px; background-color: pink;”>Box</div>
<div style=”display: inline-block; width: 100px; height: 50px; background-color: lightblue;”>Another Box</div>
Both boxes appear next to each other (inline behavior)
You can style them like blocks (with width, height, color, etc.)
Behavior:
Sits next to other elements but allows block-like styling.
Create Simple HTML Page:
<!DOCTYPE html>
<html>
<head>
<title>Creating a Simple Web Page</title>
</head>
<body>
<h1>This is heading</h1>
<p>This is a simple paragraph demonstrating an HTML element.</p>
<a href=”www.theweeklyblog.com” target=”_blank”>Checkout Our Website Here </a>
</body>
</html>
Thanks for reading!!
If you found this post helpful, stick around for more tips on web development, WordPress, and freelancing.
Join our newletter for fresh insights every week: Subscribe Here
Follow our articles on Medium: The Weekly Blog on Medium.