Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Why doesn't this background image look correct?

Posted on 2014-03-31
4
Medium Priority
?
259 Views
Last Modified: 2014-03-31
Head out to http://brucegust.com/partners/header.php

My background image looks fine in IE 8 and Safari, but it's shifting to the right in IE 11 and I don't know why.

While you can see my entire stylesheet at http://www.brucegust.com/partners/stylesheet.css, the portion that applies directly to my background image is:

img.bg {
  /* Set rules to fill background */
  min-height: 100%;
  min-width: 1620px;
      
  /* Set up proportionate scaling */
  width: 100%;
  height: auto;
      
  /* Set up positioning */
  position: fixed;
  top: 0;
  left: 0;
}

@media screen and (max-width: 1620px) { /* Specific to this particular image */
  img.bg {
    left: 50%;
    margin-left: -553px;   /* 50% */
  }
}

#header_top {
position:relative;
width:976px;
height:135px;
background-image:url(images/header_top.png);
background-repeat:no-repeat;
margin:auto;
margin-top:10px;
}

What do I need to improve in order to ensure a full screen background image in IE11?

Thanks!
0
Comment
Question by:brucegust
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 52

Assisted Solution

by:Carl Tawn
Carl Tawn earned 2000 total points
ID: 39966972
In chrome at least, it is the:
@media screen and (max-width: 1620px) { /* Specific to this particular image */
  img.bg {
    left: 50%;
    margin-left: -553px;   /* 50% */
  }
}

Open in new window

That is throwing it off.
0
 

Author Comment

by:brucegust
ID: 39967001
What should it be? I went and changed some things, kind of kicking myself for missing something that obvious, but after playing with it, I'm thinking there's more to this than just changing the margin.

I change it, but I need to the image to stretch to whatever the browser window is. How can I pull that off?
0
 
LVL 52

Accepted Solution

by:
Carl Tawn earned 2000 total points
ID: 39967014
If it is intended to be a background for the whole site, then you should make it the background-image of the body element, rather than having it as a separate img element:
body {
     background-image:url(images/header_top.png);
     ...
}

Open in new window

0
 

Author Closing Comment

by:brucegust
ID: 39967073
I just got rid of the "1620 pixel" component altogether and it looks great!

Thanks!
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating a CSS block that only applies to printing By default, all of your CSS applies to every possible view of your page - whether on screen, printed, landscape, touch-screen, or whatever.  You can, however, add CSS that only applies under certai…
This is a how to build your own CSS3 slideshow and when I say CSS3 I mean just CSS with no javascript in sight! There a few examples online of how to do this but most just show you an example without any explanation, others make it more complicat…
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question