HTML Background Image Code

This example code applies a background image to an HTML div tag using the background-image property.

Example Code

<!-- Codes by HTMLmagics -->
<div style="background-image:url('http://htmlmagics.blogspot.com/images/backgrounds/background-image-2.gif');color:blue;font-size:14px;width:300px;height:200px">This div tag has got a background image. You could also apply a background image to the whole page if you like.</div>
<p><a  style="font-size:11px;color:#999;" href="http://htmlmagics.blogspot.com/backgrounds/html-background-image.cfm">HTML background image</a></p>

 

 

Result

 


This div tag has got a background image. You could also apply a background image to the whole page if you like.