Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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,687 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!