06HTML basics

HTML Images

Easy15MIN

The HTML image tag is used to add images to an HTML page. Adding an image is done with the <img> tag (image tag), which contains several different attributes. Here is an example of using the image tag:

HTML
1<img src="kissa.jpg" width="613" height="640" alt="Caption">

"src" (source) attribute determines the image URL. This attribute is required because the browser doesn't know where to find the image without it.

**"alt" (alternative) **attribute specifies alternative text to be displayed if the image cannot be loaded correctly or if the user is using a text-only browser. This attribute is also important as it helps visually impaired users understand the content of the image.

"width" and "height" attributes define the width and height of the image in pixels. These attributes are optional, but it is recommended to use them because they help the page load faster when the browser knows how much space is reserved for the image.

Practice

TRY ITREPLIT

NOTE

Valitettavasti Replit-palvelu on muuttunut lennosta eikä enää anna suorittaa näitä koodeja suoraan selaimessa. Voit klikata alla olevaa "Open in Replit" linkkiä ja avata koodin Replit-palvelussa. Meillä on työn alla etsiä Replitille korvaaja.

Hakatemia Pro

Learn to hack — start here

Hundreds of interactive courses, virtual labs and CTF challenges in your browser. Start a free trial — no card required.