# What's wrong with this CSS?

**URL:** https://meta.discourse.org/t/whats-wrong-with-this-css/28391
**Category:** Support
**Created:** [May 6, 2015, 6:38pm UTC](https://meta.discourse.org/t/whats-wrong-with-this-css/28391 "2015-05-06T18:38:49Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Erik\_Manger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/erik_manger/32/179399_2.png) [@Erik\_Manger](https://meta.discourse.org/u/Erik_Manger)
#### Post date: [May 6, 2015, 6:38pm UTC](https://meta.discourse.org/t/whats-wrong-with-this-css/28391/1 "2015-05-06T18:38:49Z")

</div>

Hi,

I have a CSS code for Discourse backgrounds. The problem is, when I scroll down, the image doesn’t scroll down - rather, a white background appears and covers the wallpaper…

```
    html, body {
    height: 100%;
}

// solid white background for content
body:before {
    display: inline-block;
    width: 1125px;
    min-height: 100%;
    height: inherit;
    background-color: white;
    content: " ";
    position: fixed;
    left: 50%;
    right: 0;
    transform: translate(-50%, 0);
    -webkit-transform: translate(-50%, 0);
}

// compatibility for all devices
@media (max-width: 1139px) and (min-width: 1000px)
{
    body:before {
        width: 1010px;
    }
}

.d-header {
    box-shadow: none;
}

body {
  background: url('http://minecraftrad.io/images/bg1.jpg') no-repeat 50% 50% fixed; 
  background-size: cover;
  -moz-background-size: cover;
  -o-background-size: cover;
  -webkit-background-size: cover;
}

```

What’s wrong with it? The category background feature wont work because there is no white background for topics, etc. and it just simply looks bad.

All help appreciated!

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [May 6, 2015, 7:04pm UTC](https://meta.discourse.org/t/whats-wrong-with-this-css/28391/2 "2015-05-06T19:04:17Z")

</div>

I think you need to also set any wrapper elements inside of the body to `min-height: 100%`.  
I set `section#main{min-height: 100%}` to get this to work.

 ![](https://global.discourse-cdn.com/meta/original/3X/6/d/6de2b2001ddb25fab939eb14687a3db9b0a1f484.png) 

In case you aren’t already doing it, you can try these kinds of things inside of your browser’s web inspector. On Chrome, right click on a page and select ‘inspect element’. It’s a lot easier if you have 2 monitors, You can detach the inspector window and have enough room to see what is going on and try things out.

---

<div class="post-metadata">

### Author: ![Qasem\_h](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/qasem_h/32/155935_2.png) [@Qasem\_h](https://meta.discourse.org/u/Qasem_h)
#### Post date: [May 6, 2015, 7:16pm UTC](https://meta.discourse.org/t/whats-wrong-with-this-css/28391/3 "2015-05-06T19:16:19Z")

</div>

TRY THIS CODE

```
    // solid white background for content
    body:before {
        display: inline-block;
        width: 1125px;
        min-height: 100%;
        height: inherit;
        background-color: white;
        content: " ";
        position: fixed;
        left: 50%;
        right: 0;
        transform: translate(-50%, 0);
        -webkit-transform: translate(-50%, 0);
    }
    
    // compatibility for all devices
    @media (max-width: 1139px) and (min-width: 1000px)
    {
        body:before {
            width: 1010px;
        }
    }
    
    .d-header {
        box-shadow: none;
    }
    
    body {
      background: url('http://minecraftrad.io/images/bg1.jpg') no-repeat 50% 50% fixed; 
      background-size: cover;
      -moz-background-size: cover;
      -o-background-size: cover;
      -webkit-background-size: cover;

}

```

JUST FOR BACKGROUND YOU NEED FOR THIS

```
body {
          background: url('http://minecraftrad.io/images/bg1.jpg') no-repeat 50% 50% fixed; 
          background-size: cover;
          -moz-background-size: cover;
          -o-background-size: cover;
          -webkit-background-size: cover;
 }

```

---

<div class="post-metadata">

### Author: ![Erik\_Manger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/erik_manger/32/179399_2.png) [@Erik\_Manger](https://meta.discourse.org/u/Erik_Manger)
#### Post date: [May 6, 2015, 8:23pm UTC](https://meta.discourse.org/t/whats-wrong-with-this-css/28391/4 "2015-05-06T20:23:52Z")

</div>

THANK YOU THANK YOU THANK YOU!

You’re awesome, works perfectly!

---

<div class="post-metadata">

### Author: ![Qasem\_h](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/qasem_h/32/155935_2.png) [@Qasem\_h](https://meta.discourse.org/u/Qasem_h)
#### Post date: [May 6, 2015, 8:31pm UTC](https://meta.discourse.org/t/whats-wrong-with-this-css/28391/5 "2015-05-06T20:31:51Z")

</div>

Your welcome @Erik_Manger

---

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [May 7, 2015, 1:33am UTC](https://meta.discourse.org/t/whats-wrong-with-this-css/28391/6 "2015-05-07T01:33:48Z")

</div>


