Adding Images To Your Pages Using HTML

Webpage images tutorial and code

You can use any plain text editor like Notepad or TextEdit on Mac to add images to the body of your webpages. If your template is mobile or responsive do not exceed about 290 pixels in width for the image, or use the responsive code below.

See Also…

Adding a plain image:
Non-responsive, for images less than about 290 pixels wide (or for any sized non-responsive image). To add a .jpg graphic into the body of your webpage, select, copy and paste the following HTML code into your webpage:

<img src="picts/sample-image.jpg" alt="Image Description"><br>

Now create a .jpg graphic called "sample-image.jpg" and put it into your picts folder. Remember that hosting is case sensitive so don't use any capital letters on either the page code or the image file name. Make sure your page code and the graphic name match exactly.

Image Description
Sample Image #1


To center the image on the page, add css centering tags as shown below:

<div style="text-align: center;">
<img src="picts/sample-image.jpg" alt="Image Description"><br>
</div>


Image Description
Sample Image #2



Adding an image with a link:
Perhaps you want your graphic to link to another page as well, use this code:

<a href="your-page-name.htm"><img src="picts/sample-image.jpg" alt="Image Description" style="border: 0px;"></a><br>

Image Description
Sample Image #3


Or you can make the graphic link to another website. The link below goes to ebay.com for example:

<a href="http://ebay.com"><img src="picts/sample-image.jpg" alt="Image Description" style="border: 0px;"></a><br>

Image Description
Sample Image #4



Adding a responsive image:
The following code allows you to add any size image to a responsive website or template html page with a link, top and bottom margins and a centered caption. A max-width is included so the image will not exceed 650 pixels in width.


Note: This webpage is responsive. Narrow your browser width to see the image respond.


<div style="text-align: center; font-size: 16px;">
<a href="your-page-name.htm"><img src="picts/responsive-image.jpg" style="width: 100%; max-width: 650px; height: auto; margin: 5px auto 5px auto; border: 0px;" alt="Image Description"></a><br>
Sample Responsive Image<br>
</div>

Responsive Image
Sample Responsive Image






Related Topics:
New Window Target Links
Adding Page Links