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

x
?
Solved

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

Posted on 2012-03-20
3
Medium Priority
?
209 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 200 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
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.
In this tutorial viewers will learn how to style a decorative dropcap for the first letter in a paragraph using CSS. In CSS, create a new paragraph class by typing "p.fancy": Then, to style only the first letter of the first sentence, include the ps…
In this tutorial viewers will learn how to embed custom externally-hosted Google Fonts using the Google Font API in CSS Go to the Google Fonts website at google.com/fonts: Browse or search based on font properties or name to find a suitable font for…

715 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