d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Need A Bit Of Help With Html And Css.
Add Reply New Topic New Poll
Member
Posts: 143
Joined: Feb 2 2015
Gold: 10.00
Feb 3 2015 04:49pm
I'm trying to get a background to "autofit" any screen resolution so that way it doesn't automatically tile. Does anyone know how I could fix this?
Also, could you try to maybe explain the reasoning behind the code? It's okay if you don't want too though.
Member
Posts: 29,723
Joined: Jun 11 2007
Gold: 279.52
Feb 3 2015 08:36pm

html:

Code
<div id="background">
</div>



css:

Code
#background {
height: 850px;
width:928px;
background-image: url("background.jpg"):
background-repeat: no-repeat;
-moz-background-size:100% 100%;
-webkit-background-size:100% 100%;
background-size:100% 100%;
}


you can obviously change the with and height. but you need no repeat, put the image in the css, not html and make sure you have full background size.
Member
Posts: 143
Joined: Feb 2 2015
Gold: 10.00
Feb 3 2015 09:27pm
Thanks!
Member
Posts: 29,723
Joined: Jun 11 2007
Gold: 279.52
Feb 3 2015 11:19pm
np
Go Back To Programming & Development Topic List
Add Reply New Topic New Poll