• About
  • FAQ
  • Contact Us
DIYWebmastery WordPress Training, Consultancy, Web Design
  • Home
  • Our WordPress Plugins
    • AuthorSure
    • CaptionPix
    • Footer Putter
    • Genesis Club Lite
    • Genesis Club Pro
    • Genesis Dambuster
    • Slickr Flickr
    • SubscriptionBoss
  • Our Services
    • WordPress Site Design and Development
    • WordPress Individual Tuition
    • WordPress Site Review
    • WordPress Security and Forensics
    • Infusionsoft Consultancy
    • Online Business Strategy
  • Tutorials
  • Blog
Home » Tutorials » Background-Size Cover Does Not Work

Background-Size Cover Does Not Work

by Elizabeth

I was having some trouble getting a background image to stretch to cover the entire page of a site that I was building. I was using background-size:cover but it wasn’t covering. It would stretch but only in the x direction and not the y direction.

Here is the solution that I found. In the CSS where you use background-size, you need to do it like this :

[sourcecode language=”css”]
background-size:cover !important;
[/sourcecode]

It won’t work without the added important. And further, you need to make sure that this also exists in your CSS.

[sourcecode language=”css”]
html {
height: 100%;
min-height: 100%;
}
body{
min-height:100%;
}
[/sourcecode]

Filed Under: Tutorials

Return To Top
  • About
  • Affiliates
  • Contact
  • Privacy Statement
  • Terms And Conditions
2009-2025 DIYwebmastery
The Studio · Hatherleigh · Devon · EX20 3NA · UK[email protected]

DIYWebmastery Plugins

AuthorSure CaptionPix ClickMastery Footer Putter Genesis Club Lite Genesis Club Pro Genesis Dambuster Slickr Flickr SubscriptionBoss