codegurukool.com · Free coding tutorials & online compiler

Home › HTML Tutorial › HTML elements

HTML elements

Tag + content + closing tag.

Some elements are empty (br, hr, img) and have no closing tag. Elements can be nested inside each other.

Commands in this lesson

img

Definition: Embeds an image in the page.

Syntax:

<img src="file" alt="description">

Example:

<img src="x.png" alt="A sleeping cat">

Example code

<p>A paragraph with <em>nested <strong>elements</strong></em>.</p>
<hr>
Line one<br>Line two'

Run this code in the online editor

← HTML basicHTML styles →