Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS

Denis Zhidkov
Denis Zhidkov
2,660 Points

Background image doesn't appear IE

My background image doesn't appear in Internet explorer on both pages:

1) http://vote.hooters.com.ru/

.hero {

height: 100%;

width: auto;

min-height: 900px;

background-image: -webkit-linear-gradient(rgba(0, 0, 0, 0.45) 85%, rgba(0, 0, 0, 0.74) 96%), url(../images/334998332.jpg) no-repeat;

background-position: center;

-webkit-background-size: cover;

-moz-background-size: cover;

background-size: cover;

color: white;

text-align: center;

}

2) http://vote.hooters.com.ru/thanks.html

.back {

height: 100%;

width: auto;

background-image: -webkit-linear-gradient(rgba(0, 0, 0, 0.45) 85%, rgba(0, 0, 0, 0.74) 96%), url(../images/thanks.jpg) no-repeat;

background-position: center;

-webkit-background-size: cover;

-moz-background-size: cover;

background-size: cover;

color: white;

text-align: center;

}

What can cause it?

2 Answers

Sergey Podgornyy
Sergey Podgornyy
20,660 Points

This property valid only for IE9 and newer - http://www.w3schools.com/cssref/css3_pr_background-size.asp. Which version of IE do you use?

Sergey Podgornyy
Sergey Podgornyy
20,660 Points

Try linear-gradient with all prefixes:

background-image: -webkit-linear-gradient(rgba(0, 0, 0, 0.45) 85%, rgba(0, 0, 0, 0.74) 96%), url(../images/334998332.jpg) no-repeat;
background-image: -o-linear-gradient(rgba(0, 0, 0, 0.45) 85%, rgba(0, 0, 0, 0.74) 96%), url(../images/334998332.jpg) no-repeat;
background-image: -moz-linear-gradient(rgba(0, 0, 0, 0.45) 85%, rgba(0, 0, 0, 0.74) 96%), url(../images/334998332.jpg) no-repeat;
background-image: linear-gradient(rgba(0, 0, 0, 0.45) 85%, rgba(0, 0, 0, 0.74) 96%), url(../images/334998332.jpg) no-repeat;
Austin Whipple
Austin Whipple
29,725 Points

So I unfortunately don't have IE to test this out and see what the issue might be, but here are a couple things that could help (including the proper prefixing as mentioned by Sergey):

  1. Use background instead of background-image for your main declaration.
  2. Declare background-position inside the new background property rather than separately. (At the end.)

If that doesn't help, I've always found success using an ::after or ::before psuedo elements to create filters on background images. Add these styles along with your gradients to the psuedo element to get the positioning set:

    content: ' ';
    width: 100%;
    height: 100%;
    position: absolute;
    bottom: 0;
    left: 0;
    display: block;

Sorry I can't be of more help with troubleshooting!