How to Insert Image in HTML using Notepad | HTML Images
For creating a Beautiful eye-catching website, Images pays a Huge role.
By using Beautiful and eye-catching image or Images in html Document you can grab some attention and make your Website more pleasing to the eye. So in this Tutorial, we are going to discuss some methods about How to insert image in HTML using notepad.
HTML Image Syntax
index.html
<img src="ImagePath"/>
As we all know that in HTML we have to use tags to insert or show HTML Elements inside our Browsers or HTML Document.
For inserting images in HTML we have IMG Tag for that.
Where HTML IMG tag will declare a Section to show Image Data.
But we have to use other HTML IMG Tag's attributes to insert an Image, image size [Height and Width] and other things to Insert and Show a Proper Image inside our HTML Document/Web-page.
Image Tag's SRC Attribute
HTML IMG tag's SRC attribute carries the Path of our Image file (That we want to Insert in HTML).
Where we have to give our Image file's name followed bye the Image Extension (.jpg/.png/.gif ETC).
NOTE : If your Image file and your HTML file is present at the same location/Folder, Then you only have to give your Image file's name followed by the Image Extension (like .jpg).
But if your Image file is Present at Different Location/Folder then you have to Give the Full path of your Image file (Like C:/user/myName/Desktop/HTML/myImage.jpg).
index.html
<img src="myImage.jpg"/>
Need a Personal Tutor?
I am here to help you with your Programming journey. HTML, CSS, JavaScript, ReactJS, NextJS, C, C++, C#, SQL and more.
Image Tag's Height and Width Attribute
Image tag's Height and Width attribute allow us to set custom Height and With to our HTML Image.
We can assign our HTML Image Height/Width in Pixels (px) or Percentage (%) it Totally depends on you.
index.html
<img src="myImage.jpg" width="100px" height="100px"/>
FAQ about : How to insert image in HTML using notepad
how to insert background image in HTML using notepad
To insert background image in HTML using notepad, we have to use CSS's background Property. Which allow us to set background images to HTML Elements.
Where inside CSS's background : url Property we have to give our image file's name followed by the Files extension.
Add a background image on a HTML element:
index.html
<html>
<body style="background-image: url('myImg.jpg');">
</body>
</html>
Specify the background image in the style element:
index.html
<html>
<head>
<style>
body{
background: url("myImage.jpg");
}
</style>
</head>
<body>
</body>
</html>
How to insert image in HTML using notepad step by step
Step 1: Open Notepad text Editor
Press Start button on Windows and Search for Notepad. Select and double click Notepad from the Search Results. Your notepad text Editor will run right after that.
Step 2: Write HTML Image Syntax
Write HTML Image Synax where we have yto use HTML IMG tags to insert/Show Images insdie our HTML Webpage.
index.html
<img src="imageFileHere"/>
Step 3: Write your Image file's Name
We have to use SRC for assigning our image files Name followed by the Image Extension.
index.html
<img src="myImage.jpg"/>
Step 4: Save your HTML file
Save your HTML file using Notepad text editor's File menu or you can use the ctrl+s to save your HTML File in Notepad.
Step 5: Run your HTML file in Browser
After saving your HTML file, locate your HTML file and Run it on the Web Browser.
Need a Personal Tutor?
I am here to help you with your Programming journey. HTML, CSS, JavaScript, ReactJS, NextJS, C, C++, C#, SQL and more.
How to add images in HTML using notepad and how to insert pictures in HTML notepad
If you want to Insert Images (Multiple Images) in HTML using Notepad, Then you have to use Multiple Image tags with multiple Images. Just keep in mind, HTML Image tags doesn't have any closing tags. SO you don't have to close it. Just add multiple images as shown in the Example below:
index.html
<html>
<body>
<img src="myImage1.jpg"/>
<img src="myImage2.jpg"/>
<img src="myImage3.jpg"/>
<img src="myImage4.jpg"/>
</body>
</html>
FAQ About: how to insert image in HTML using notepad
how to insert a photo in HTML using notepad
To insert a photo in HTML using notepad, we have to use HTML's IMG tag.
which will allow us to insert Images inside our HTML Document.
For inserting a photo in HTML using notepad, we have to put our Image file's path, inside our IMG tag's SRC attribute.
Example: how to insert a photo in HTML using notepad
index.html
<html>
<head>
<title>Images in HTML</title>
</head>
<body>
<img src="MyPhoto.jpg"/>
</body>
</html>
how to insert a picture in HTML notepad
To insert a picture in HTML notepad we have to use an HTML IMG tag. where we have to give our Image's path inside the HTML IMG tag's SRC attribute.
Example: How to insert a picture in HTML notepad
index.html
<html>
<head>
<title>Images in HTML</title>
</head>
<body>
<img src="myPicture.jpg"/>
</body>
</html>
Need a Personal Tutor?
I am here to help you with your Programming journey. HTML, CSS, JavaScript, ReactJS, NextJS, C, C++, C#, SQL and more.
how to insert image in HTML using notepad from desktop
To insert an image in HTML using notepad from the desktop we need to create an HTML file inside your Desktop first.
After that, we have to write an HTML Image tag (IMG) and using the HTML IMG/image tag's SRC attribute we are going to give the filename and extension of the Image file from the Desktop.
Example: How to insert image in HTML using notepad from desktop
index.html
<html>
<head>
<title>Images in HTML</title>
</head>
<body>
<img src="myImageFromDesktop.jpg"/>
</body>
</html>
how to put a background image in HTML notepad
To put a background image in HTML notepad, we need to use Inline CSS/Style.
Where using style attribute we can use inline Style/CSS and inside this style attibute we are going to use background-image: url('path') we are going to add an Background image.
Example: how to put a background image in HTML notepad
index.html
<html>
<head>
<title>Images in HTML</title>
</head>
<body style="background-image: url('myImage.jpg');">
</body>
</html>
how to put a picture in notepad
We can't but Images in Notepad but using Notepad we can put a Picture in our HTML Document.
To add/put pictures in HTML using Notepad we need to use IMG tag and IMG tag's src attribute.
HTML image code notepad
index.html
<html>
<head>
<title>Images in HTML</title>
</head>
<body>
<img src="myImage1.jpg"/>
<img src="https://programminghead.com/my-Images/content-Images/how-to-insert-image-in-HTML-using-notepad.jpg"/>
</body>
</html>
How to Put Photos in HTML
For inserting / Putting Photos in HTML we have to use HTML IMG tags. Where inside the SRC attribute we havbe to give our Photo's Path (filename with Extesion, if your Photo and HTML file is present at the same location).
index.html
<html>
<body>
<img src="myphoto.jpg"/>
</body>
</html>
Need a Personal Tutor?
I am here to help you with your Programming journey. HTML, CSS, JavaScript, ReactJS, NextJS, C, C++, C#, SQL and more.
How to insert background image in HTML from local folder
To insert a background image in HTML from a local folder you need to give only the Image File's name followed by the Image Extension.
(If you don't know the file extension of your image file, then you need to
Right Click on your image File, and select Properties from there. There you can find your Image Files Extension like jpg, png, gif).
Now you can add this image background by using the Image file's name and extension.
index.html
<body style="background: url('mypic.jpg');">
<h1>HTML Backghround Image</h1>
</body>
If this is not working, then make sure your Image filename and extension are correct and your HTML file and the Image file are present at the same location / Same Folder.
How to add background image in HTML using CSS [background-image: url]
To add background image in HTML using CSS we can use CSS "background-image" property. Where under url("pathHere") we have to give our Image files path.
If your image and HTML file is Present in the same folder, you can add a background image just by providing the image file's name followed by the Image extension.
index.html
body{
background-image: url("myimage.jpg");
}
If your image is present at a different location then make sure you give the fill path here.
To get FullImagePath
RightClick (on your Image) > select properties > under the Security tab you can get the full image file path.
index.html
body{
background-image: url("C:/user/Desktop/myimage.jpg");
}
How to add background image in HTML visual studio code
To add background image in HTML visual studio code you just need to use CSS "background: url()" property.
And after that under "url()" you need to provide the image file's path.
index.html
<html>
<head>
<title>VSCode Background Image</title>
<style>
body{
background: url("myimage.jpg");
}
</style>
</head>
<body>
</body>
</html>
How to insert image in HTML from folder
To insert an image in HTML from a folder, we need to provide the Folder Name with the Image name and the Image Extension.
As you already know that in HTML we need to use IMG tags for inserting images in HTML. Where SRC attribute handles the source of our image.
So you just need to write your folder name followed by the image file name and the Image file's extension.
index.html
<img SRC="foldername/imagename.jpg"/>
This is only going to work if your folder is present at the same location, where your HTML file is present.
If your Image folder is present at a different location, then you need to move your image folder to the location where your HTML file is present or you can use Full Image Path.
How to get the Full Image Path from an Image
To get the full image path from an Image, you need to open file Explorer > select your Image > right-click > select Properties > security > copy object path (Which will look something like C:/user/yourName/Desktop/image/myimage.jpg").
Now you need to use this Full image path inside your HTML Image Tag's SRC Attribute.
add file:/// at the beginning to make your browser understand the source
index.html
<img src="file:///C:/user/yourName/Desktop/image/myimage.jpg"/>
Need a Personal Tutor?
I am here to help you with your Programming journey. HTML, CSS, JavaScript, ReactJS, NextJS, C, C++, C#, SQL and more.
Can i type on an image in HTML
If you want to show your TEXT over an Image, then yes you can type on an Image in HTML.
For that you need to put both your Image <img> and text <p> inside a folder.
Then you need to make sure that the present Div (Div that includes both the Image and the TEXT) has position set to relative and your Text position set to absolute.
This will make your Text visible over your Image.
index.html
<html>
<head>
<style type="text/css">
#myDiv{
position: relative;
}
#myText{
position: absolute;
top:0;
}
</style>
</head>
<body>
<div id="myDiv">
<img src="https://www.programminghead.com/logo/logo.png"/>
<p id="myText">This is my TEXT that i want to Display over the IMAGE</p>
</div>
</body>
</html>
How to insert image in notepad++
It doesn't matter which Text/Code editor you use, the method of inserting images in notepad, notepad++, sublime and VS Code always going to remain the same.
Where you need to use HTML Image tag for inserting images.
HTML Image tag's SRC attribute is where you need to provide you image source and that's all.
index.html
<img src="myimage.jpg"/>
HTML body background image
To add Background image in HTML Body, you need to use use CSS for that.
Where you can use Internal CSS, External CSS and also inline CSS to do the same thing.
We have given all the 3 methods below to add HTML Body background image.
Method 1: by using in-line CSS
To add background image by using inline CSS, you just need to select the body tag. Inside the body tag's starting tag, you need to use style attribute.
Where style attribute is capable of adding CSS properties to any HTML element.
So by using style attribute inside Body tag we will add the background image by using CSS background-image property.
Where we need to provide the source of our image inside url('').
index.html
<html>
<body style="background-image: url('myimage.jpg')">
</body>
</html>
Method 2: by using Internal CSS
Internal CSS also works like inline CSS, but you need to include CSS properties inside <style> tags.
Make sure that you include the style tags inside HTML head tags. Because we need to include styles at the begin of our page load.
Where by using style tags we can add CSS properties to any HTML elements.
To select any HTML element, we can use ID, class or tag name.
Here we are going to select the body tag by use it's tag name inside CSS.
And we will add the background-image CSS property to it.
index.html
<html>
<head>
<style type="text/css">
body{
background-image: url('myimage.jpg');
}
</style>
</head>
<body>
</body>
</html>
Method 3: by using External CSS
External CSS works exactly like internal CSS, the only difference is that our CSS file is present outside/Externally and we need to link it to our HTML by using <link> tag.
style.css
body{
background-image: url('myimage.jpg');
}
index.html
<html>
<head>
<link rel="stylesheet" href="style.css"/>
</head>
<body>
</body>
</html>
HTML background image full screen notepad
Want to use background image full screen by using notepad?
Then use this code if you want your background image to use the full screen and also if you want to make sure that your background image always aligns at the center, background image doesn't repeat, Stay in one place even on Page Scroll and ETC.
style.css
body{
background-image: url('myimage.jpg');
//adding image
background-repeat: no-repeat;
//Stoping Background from repeating
background-size: cover;
//Setting background to cover full width and height
background-position: center;
//Makes background to align center
background-attachment: fixed;
//Background will stay in one position on scroll
}
On This Page
Need a Personal Tutor?
I am here to help you with your Programming journey. HTML, CSS, JavaScript, ReactJS, NextJS, C, C++, C#, SQL and more.