How do set background image to fit screen size without css positioning? Im doing school work and I would like to set a background image but my professor said I cannot use positioning so is there another way around it?
Asked
Active
Viewed 6,323 times
0
-
3Can you use _background positioning_? That is a weird restriction. – Christian Dec 03 '12 at 15:53
-
This has been asked: http://stackoverflow.com/questions/376253/stretch-and-scale-css-background – Dave Dec 03 '12 at 15:54
-
No I can't use anything that includes the word position – Jae Song Dec 03 '12 at 15:54
-
1css properties left,right, margin, padding doesnt have word "position" in them..!!! – Parag Dec 03 '12 at 15:58
1 Answers
2
Try this
html{
background:url('backgroundimage.jpg') no-repeat center center;
min-height:100%;
min-width:100%;
background-size:cover;
}
body{
min-height:100%;/*hack for some mobile browsers */
min-width:100%;
}

Parag
- 4,754
- 9
- 33
- 50