How to Add unsplash image in HTML

Do you want to add Unsplash image in HTML? Follow the below steps to add Unsplash image in HTML.

Step 1: Go to unsplash.com and then search for the image you want to add.

Step 2: After you find the image you want click on it to open it in full view.

Step 3: Go to the download section

Step 4: Select the size you want to use and download it by clicking on the download button.

Step 5: Use the below html code to add Once you find the image, click on it to open it in full view.

<!DOCTYPE html>
<html>
<head>
<title>My Webpage</title>
</head>
<body>
<h1>Welcome to code the best !</h1>
<img src="path/to/your/image.jpg" alt="Description of your image">
</body>
</html>
How to Add unsplash image in HTML
Add unsplash image in HTML

Explanation of the code( Line 8 is  the main part)

Line 1: Telling the browser it is html document.

Line 2: html tag.

Line 3: Head tag.

Line 4: Title of the page.

Line 5: Closing of the head tag.

Line 6: Opening of the body section.

Line 7:  H1 tag with the text Welcome to code the best!.

Line 8: img tag with the source src. It will contain the path of the image which is the URL of the Unsplash image. The alt attribute for the image description. It is useful when the image is not downloaded to your webpage.

Line 9: Closing of the body tag

Line 10: Closing of the HTML tag telling the browser that HTML document has ended in this line.

That’s all you have to do How to Add Unsplash images in HTML.

Hi, I am CodeTheBest. Here you will learn the best coding tutorials on the latest technologies like a flutter, react js, python, Julia, and many more in a single place.

SPECIAL OFFER!

This Offer is Limited! Grab your Discount!
15000 ChatGPT Prompts
Offer Expires In:
close-link