Solved

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

Posted on 2012-03-20
3
159 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
3 Comments
 
LVL 21

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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
The viewer will learn how to dynamically set the form action using jQuery.

707 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now