Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4622440
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T02:50:38+00:00 2026-05-22T02:50:38+00:00

It’s actually two part question regarding my simple page (that will be replaced some

  • 0

It’s actually two part question regarding my simple page (that will be replaced some day with real content), HTML+CSS boilerplate used there for vertical centering and IE7.

http://engitize.net/

  1. Can anyone provide detailed explanation why the page is displayed correctly in non-IE browsers (Chrome, Fx, Opera), almost all semi-recent to recent IEs (IE5.5, IE6, IE8, IE9), but not in IE7?

    I am especially interested in: it works in IE6, yet it doesn’t work in IE7, because… kind of explanation.

  2. What should be changed to make div#c properly centered vertically in IE7?
    I am using specific height for div#c, but used boilerplate is height-agnostic and fix should preserve this feature.

    Spoiling other browsers is not an option, unless it’s IE5.5 (ok, IE6 too, but only if it is really unavoidable).

    Changing <!DOCTYPE html> and turning IEs into quirks mode is also not accepted (and it’s a pretty bad practice for newly developed pages).

If you don’t have IE7 (just as I), you can visit http://ipinfo.info/netrenderer/ or http://browserling.com/, paste URL there and choose IE7 to see the problem yourself.


Because the page will change after accepting some answer, I’m providing snapshot of relevant HTML and CSS parts from it (with logo URL changed to be absolute).

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<style type="text/css">
html, body { height: 100%; }
body { background-color: #fff; color: #000; margin: 0px; padding: 0px; }
div { margin: 0px; padding: 0px; }
#outer { position: relative; width: 100%; height: 100%; overflow: visible; }
#outer[id] { display: table; position: static; }
#middle { position: absolute; top: 50%; width: 100%; text-align: center; } /* for explorer only*/
#middle[id] { display: table-cell; vertical-align: middle; position: static; }
#c { position: relative; top: -50%; } /* for explorer only */
#c { width: 385px; height: 120px; margin-left: auto; margin-right: auto; }
#c { background-image: url(http://engitize.net/engitize.png); background-repeat: no-repeat; background-position: center top; }
#c div { position: relative; top: 100px; width: 100%; color: #666; font-weight: bold; font-family: serif; font-size: 12px; text-align: right; }
#footer { width: 100%; text-align: center; height: 15px; padding: 5px 0 0 0; margin: -20px auto 0 auto; border: 0; background-color: #def; } 
#footer div { padding: 0px 5px 0px 5px; text-align: right; font-size: 10px; font-family: sans-serif; }
a { text-decoration: none; color: #006; }
a:hover { color: #00c; }
p { margin: 0px; padding: 0px; }
</style> 
</head>
<body>
<div id="outer"><div id="middle"><div id="c"><div> 
because history is important!
</div></div></div></div> 
<div id="footer"><div> 
<p style="float:left;"><strong>Przemysław Pawełczyk</strong>'s imprint | Coming in 2012!</p> 
<p style="float:right;"><a href="http://przemoc.net/">Przemoc's network</a></p> 
</div></div>
</body>
</html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T02:50:38+00:00Added an answer on May 22, 2026 at 2:50 am

    your Q#1 has been answered by @thirtydot, IE7 and below does not support the CSS table properties so another way has to be found for them. and his absolute positioning technique is usually the preferred way to do this as most times in a scenario like this (splash page?) the width and height of the centred content would be known.

    addendum to above per comments:
    In answer to why it was working in IE6 and not IE7 even though IE6 doesn’t support the table properties either, IE7 was actually picking up the position: static rule from the #middle[id] {} rule – IE7 does understand this type of selector so this means the later absolute/relative positioning was not working the same as it was in IE6

    Taking the above into account redoing the CSS to make sure IE7 and 6 got the same CSS and that it was placed later in cascade to override the “good” CSS it turns out the the positioning method is height agnostic too, in the comments there are various links to to test this, but here is the final working version:

    Hybrid table cell/positioning method : here

    That fiddle does include the image width and heights, but if you remove them and the positioning for the “sub text” it does (or should) show that whatever is in the middle does stay centered

    HTML used is the same as the bottom of this answer.. minus the extra <i></i> element

    CSS:

    html, body { height: 100%; margin: 0; padding: 0;}
    body { background-color: #fff; color: #000;  }
    
    #outer {
        position: relative;
        width: 100%;
        height: 100%;
        display: table;
    }
    
    #middle { 
        display: table-cell; 
        vertical-align: middle;
        text-align: center;
    }
    
    #c {
        width: 385px;
        height: 120px;
        margin: 0 auto;
        background: url(http://engitize.net/engitize.png) no-repeat 50% 50%;
    }
    
    /**** for IE7 and below ****/
    /* hacks but there is another method below */
    #middle {
      *position: absolute;
      *top: 50%;
      *width: 100%;
      *text-align: center;
      }
    
    #c {
      *position: relative;
      *top: -50%;
    }
    
    /**** end IE7 and below rules ****/
    
    
    #c div {
        position: relative;
        top: 100px;
        width: 100%;
        color: #666;
        font-weight: bold;
        font-family: serif;
        font-size: 12px;
        text-align: right;
    }
    
    #footer {
        width: 100%;
        text-align: center;
        height: 15px;
        padding: 5px 0 0 0;
        margin: -20px auto 0 auto;
        border: 0;
        background-color: #def;
    }
    #footer div {
        padding: 0px 5px 0px 5px;
        text-align: right; font-size: 10px;
        font-family: sans-serif;
    }
    #footer p {margin: 0;}
    

    As pointed out in comments using the technique that the HTML5 boilerplate uses to class the HTML element conditionally see:

    Conditional stylesheets vs CSS hacks?
    Answer: Neither!

    means you could replace the IE7 hacks with:

    .ie6 #middle, .ie7 #middle {
      position: absolute;
      top: 50%;
      width: 100%;
      text-align: center;
    }
    
    .ie6 #c, .ie7 #c {
      position: relative;
      top: -50%;
    }
    

    Original alternative – “Matchstick Technique”

    You could likely mix the following technique with the “table-cell” technique via conditional comments or hacks, but this (hacky!) technique works across browser as far as my tests have seen

    As you’ve asked for a height agnostic version.. you might or might not like the “matchstick” technique, this involves using inline blocks and lining them up.. the “matchstick” is a 100% high empty, off page, inline-block element with its vertical-alignment set to “middle” once it’s in place the next inline-block (your actual content div) sits beside it and aligns to the middle or it, then using text-align: center; on it you have the horizontal centering too

    here’s a link to a working example fiddle

    Note: I’ve left your widths intact, but you can test without widths/heights by removing the height & width off #c and also remove the CSS for the #c div text div – in a plain text scenario entering text into either of these divs should ‘auto’ centre.

    and especially note the insertion of the extra <i></i> HTML just inside the outer div (that’s likely why this is not a preferred method!), this is the “matchstick” that props the whole page open.

    Code used in fiddle:

    html, body { height: 100%; margin: 0; padding: 0; }
    body { background-color: #fff; color: #000; }
    
    #outer { position: relative; width: 100%; height: 100%;}
    
    /* a matchstick spacer */
    #outer i {
     display: inline-block; 
     height: 100%; 
     width: 1px; 
     margin-left: -1px; /* to hide off page */
     margin-right: -4px; /* to remove spacing between this and #middle block */
     vertical-align: middle; /* will make inline block next to it center vertically */
     background: #f00; /* red, not required just to see or not see it */
     }
    
    #middle { 
      display: inline-block;
      width: 100%;
      text-align: center;
      vertical-align: middle;
    } 
    
    /* image 385 * 120 */
    #c { 
      display: inline-block;
      /* presuming image heights, but it wouldn't matter if there was width/height here or not */
      width: 385px; 
      height: 120px; 
      background: url(http://engitize.net/engitize.png) no-repeat 50% 50%; 
    }
    
    #middle, #c { /* IE hack for inline block on block level elements */
     *display: inline; 
    }
    
    
    #c div { position: relative; top: 100px; width: 100%; color: #666; font-weight: bold; font-family: serif; font-size: 12px; text-align: right; }
    
    #footer { width: 100%; text-align: center; height: 15px; padding: 5px 0 0 0; margin: -20px auto 0 auto; border: 0; background-color: #def; } 
    #footer div { padding: 0px 5px 0px 5px; text-align: right; font-size: 10px; font-family: sans-serif; }
    
    a { text-decoration: none; color: #006; }
    a:hover { color: #00c; }
    p { margin: 0px; padding: 0px; }
    

    HTML:

    <div id="outer">
      <i></i>
      <div id="middle">
          <div id="c"><div>
            because history is important!
          </div></div>
      </div>
    </div>
    
    <div id="footer">
      <div>
       <p style="float:left;"><strong>Przemys?aw Pawe?czyk</strong>'s imprint | Coming in 2012!</p>
       <p style="float:right;"><a href="http://przemoc.net/">Przemoc's network</a></p>
      </div>
    </div>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Seemingly simple, but I cannot find anything relevant on the web. What is the
I have a French site that I want to parse, but am running into
Does anyone know how can I replace this 2 symbol below from the string
this is what i have right now Drawing an RSS feed into the php,
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I want to count how many characters a certain string has in PHP, but
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.