Skip navigation
Currently Being Moderated

absolute positioning problem in IE7

Oct 21, 2011 7:50 AM

Tags: #ie7

Hello Dreamweavers,

 

I am having a problem with an new site I am working on.

In the left top corner there are two absolutely positioned elements: an image and a H1 heading like so:

 

 

.primary h1 {

          position:absolute;

          left:20px;

          top: 90px;

          z-index:100;

}

 

 

.masthead {

          position: absolute;

          left:60px;

          top: 20px;

          z-index:101;

}

 

both elements are in div .primary which has a position: relative.

Works well in all browsers except for IE7

In the screenshot you can see that the h1 heading seems to disappear behind the white square of the slideshow pushing the image down.

 

 

I tried different things, like setting "display: inline" to floated elements but no succes yet.

 

Site is here:

 

http://www.productfotografie-fotograaf.nl/

 

screenshot is here:

 

http://dl.dropbox.com/u/604341/screenshotie7.png

 

What could this be?

 

Bob

 
Replies
  • Currently Being Moderated
    Oct 21, 2011 7:51 AM   in reply to EagerBob

    Screenshots don't help us with your code.  Can you post a link to the live page, please?  And are you sure it's important to worry about IE7?

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 21, 2011 8:02 AM   in reply to MurraySummers

    I agree. with IE 7 now accounting for about 2.1% of all web users, it may not be worth the effort to accomodate them.

    That said, I'm no big fan of APDivs unless they are absolutely necessary (ie: a floating image in a header or a text box with nothing else under it). They tend to cause more problems than they solve when you're dealing with display sizes from 3.5 inches to 40 or bigger. They can end up all over the place.

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 21, 2011 8:29 AM   in reply to EagerBob

    I would solve the problem by a) making that camera the background image of the container div, and using background-position to nudge it to the location you want (with background-repeat:no-repeat, of course), and b) then just letting the <h1> fall where it wants which should be close to where it is.  Get rid of the absolute positioning altogether....

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 21, 2011 8:34 AM   in reply to EagerBob

    I hit a "cached" page and was inadvertently looking at an old IE6 stat in my previous post. I stand corrected about the 2.1% quote. IE7 only accounts for 3.9% of all IE users (http://www.w3schools.com/browsers/browsers_explorer.asp) and Internet Explorer only accounts for 22.9% of ALL web users (http://www.w3schools.com/browsers/browsers_stats.asp), so you're basically trying to please 3.9% of 22.9% of everyone on the web. That's one tenth of one percent or 0.0092 of the people who can visit the page. Hardly seems worth the effort to me, but then I don't build anything for IE7 anymore.

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 21, 2011 8:44 AM   in reply to Curtis_E_Flush

    Certainly seems like a waste for that purpose, but I think the change I recommend is good in general.  We can forget that it's to accommodate IE7 users, and just do the change for general principles!

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 21, 2011 9:27 AM   in reply to EagerBob

    Only thing is I recently heard Matt Cutts saying that you shouldn't br really doing that...

     

    Listen to Matt.

     

     

    That was the point. I want the image to sligthly overlap the H1, since it has a reflection that sits over the H1, giving it a bit  of a shine and more of  a"logo" look.

     

    OK - make the <h1> position:relative, and include the camera image within the <h1> along with the text.  Use something like this -

     

    h1 img { position:absolute;top:-75px; }

     

    and adjust the left/top values to put the overlap where you want it.  In this case, I'll allow you to use the absolute positioning.

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 21, 2011 9:35 AM   in reply to Curtis_E_Flush

    I'd be suspect of the W3Schools web browser usage stats. Keep in mind those are the statistics for their particular site only, which I'd think lean heavily towards the type of people that are more likely to upgrade their browser.

     

    This site reports ie7 at almost 11%, which is much more believable in my opinion:

     

    Stat Owl

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 21, 2011 10:15 AM   in reply to JoeyD1978

    I'm pretty sure if I looked hard enough I could find a site that says XP SP1 32 bit still accounts for 50% of ALL computer users. That's neither here nor there. IE is currently in an early beta for 10 (I'm testing it). 7 will soon go the way of  6, and Netscape and the original Mozilla browser.

     

    Especially when it come to a commerce site, I take the approach that if someone is still using a six year old browser on a four or five or six year old computer, they aren't looking to spend any money they don't have to and are likely to be a visitor versus a customer. That's not to say they don't just take good care of their stuff, but in the world of computers, it's like driving a 55 Chevy as your main transportation. It doesn't run well on today's unleaded gas, it doesn;t get nearly enough mileage for $3.50 a gallon, and if it gets hit or breaks down it's costly and time consuming to repair it with the parts being as old as they are.

     

    But I digress from the original point of this post - the APDiv. I think Murray has the best solution in doing away with it altogether and using the image as a background or incorporating it with the text in the h1 tag.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points