Solved

Div not centering and loses pad at the top in IE (Compatibility Mode)

Posted on 2012-03-20
3
179 Views
Last Modified: 2012-03-27
I have a table row that is not centering completely and it loses padding at the top in IE (Compatibility mode)?

Here is the code.


#gaugetitle
{
      font-family:Arial, Helvetica, sans-serif;
      margin-left:auto;
      margin-right:auto;
      width:50%;
}

The HTML.

<div id="gaugetitle"><h3>Lab Balance Score Card Metrics</h3></div>

The div is sitting between two tables.

Thanks,

Dave
0
Comment
Question by:hrhs
[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
3 Comments
 
LVL 22

Accepted Solution

by:
Kim Walker earned 50 total points
ID: 37745542
Earlier versions of IE do not apply auto margins properly. It is necessary to assign text-align: center to the parent element in order for the div to center. Be sure to assign text-align left to the centered div in order to override the parent div setting. Example:
<div style="text-align: center; width: 300px; border: solid 1px #000;">
	<div style="text-align: left; width: 150px; margin: 12px auto; border: solid 1px #000;">This div is centered in it's parent div with left-aligned child text.</div>
</div>

Open in new window

0
 
LVL 16

Expert Comment

by:s8web
ID: 37746534
If xmediaman's suggestion doesn't do the trick, please post your full, browser parsed code or a link (preferred). Your snippet doesn't provide the whole picture.
0
 

Author Closing Comment

by:hrhs
ID: 37772739
Thanks...
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
This article discusses four methods for overlaying images in a container on a web page
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

752 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