Click here to Skip to main content
15,886,806 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I need to set background image in HTML5. I don't want to use any CSS files. Is there any possibilities. Can any1 help in this.
Posted

Yes google[^] can, with 11,60,00,000 results
 
Share this answer
 
If you do not want css file, fine, use inline css like this:
<body style="background-image:url('imagefile.png');">

Do not use "background" which is not supported in HTML5.
Read more: Beginner's Guide to HTML5 & CSS3 - Styling Your First Web Page[^]
 
Share this answer
 
v2
Comments
Usha Red E 24-May-14 4:53am    
Thank you Mr.Peter Leow. Should I include Local Folder path like 'D:\MyFolder\ImageFolders\Desert.JPEG' or only Image name 'Desert.JPEG'.
try this.. :)

HTML :)
HTML
<div class="backDiv"></div>


CSS.. :)

CSS
.backDiv
{
    height:200px;
    width:200px;
    background-image:url('http://www.menucool.com/slider/prod/image-slider-5.jpg');
    }


CHECK MY FIDDLE.. :)

http://jsfiddle.net/nhrzs/[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900