Full Page Background image
How to make an background image scalable base up on screen resolution using HTML ? My image is 2200x2200
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Sunny SharmaRank #223 · 11.1K reputationPosted Aug 1, 2013, 3:44 AM EDT
Follow the style below:
---------------------
body
{
margin:0;
background:url(http://www.all-hd-wallpapers.com/wallpapers/abstract/330021.jpg) no-repeat fixed top center;
background-color:#000001;
background-size:100%;
}
----------------------
Keep the Background-color matching to your image for just in case the image is loading or can't be loaded. It will maintain the feel of your image till it get's fully loaded. Size will not matter to make it in full background but yes, it may be sucking your bandwidth. I would suggest you to reduce the size as far it fits and looks good.
Hope it helps.
Cheers!
Iftikar HussainRank #423 · 5.9K reputationPosted Aug 1, 2013, 3:54 AM EDT
Try like this
Regards,
Iftikar
David SmithRank #999 · 2K reputationPosted Aug 1, 2013, 4:06 AM EDT
Review code below to see what I am going. I got it to work. As the page resolution gets bigger or smaller, the layout changes.
CSS:
HTML CODE:
Iftikar HussainRank #423 · 5.9K reputationPosted Aug 1, 2013, 4:13 AM EDT
Regards,
Iftikar
Sunny SharmaRank #223 · 11.1K reputationPosted Aug 1, 2013, 4:16 AM EDT
David SmithRank #999 · 2K reputationPosted Aug 1, 2013, 4:49 AM EDT
The solution i posted work. I can see the entire image upon resize with no problem.
ftikar Hussain is it better to use javascript instead?
David SmithRank #999 · 2K reputationPosted Aug 1, 2013, 4:51 AM EDT
David SmithRank #999 · 2K reputationPosted Aug 1, 2013, 5:02 AM EDT
Iftikar HussainRank #423 · 5.9K reputationPosted Aug 1, 2013, 7:29 AM EDT
Regards,
Iftikar
Iftikar HussainRank #423 · 5.9K reputationPosted Aug 1, 2013, 7:30 AM EDT
Regards,
Iftikar
David SmithRank #999 · 2K reputationPosted Aug 1, 2013, 9:58 AM EDT
Iftikar HussainRank #423 · 5.9K reputationPosted Aug 1, 2013, 7:56 PM EDT
Regards,
Iftikar
Sharad RathoreRank #3,483 · 416 reputationPosted Aug 10, 2013, 11:51 AM EDT
Try like this
body
{
background-image: url(title.gif);
background-repeat: no-repeat;
}
Regards,
Sharad kumar rathore