# Is this CSS for background imagery good?

**URL:** <https://meta.discourse.org/t/is-this-css-for-background-imagery-good/34358>\
**Category:** Product Support\
**Created:** [11 أكتوبر 2015، 1:06ص UTC](https://meta.discourse.org/t/is-this-css-for-background-imagery-good/34358 "2015-10-11T01:06:20Z")\
**Posts on this page:** 1\
**Showing post:** 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:** [11 أكتوبر 2015، 1:06ص UTC](https://meta.discourse.org/t/is-this-css-for-background-imagery-good/34358/1 "2015-10-11T01:06:20Z")

</div>

Hi,

A friend of mine gave me this code to use on Discourse for background imagery. It works fine but I was wondering if the way it is coded could be perfected a little more?

```
// 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;
    }
}

body {
  background: url('https://i.imgur.com/12WWafT.jpg') no-repeat 50% 50% fixed; 
  background-size: cover;
  -moz-background-size: cover;
  -o-background-size: cover;
  -webkit-background-size: cover;
}

```

---

_[View the full topic](https://meta.discourse.org/t/is-this-css-for-background-imagery-good/34358)._
