简体   繁体   English

文本对齐:居中居中,导致中继器居中,没有覆盖功能

[英]text-align: center in body causing repeater to center with no override ability

I have an asp.net repeater that centers in IE 7, but left justifies in FF. 我有一个以IE 7为中心的asp.net中继器,但在FF中没有对齐。 I want it to left justify. 我希望它证明理由。 I noticed in css if I remove: 如果删除,我在CSS中注意到:

body {
text-align:center;
}

The repeater left justifies in IE. 中继器在IE中对齐。 Problem is, practically the whole site shifts left too...this is not good. 问题是,实际上整个站点也向左移动...这不好。 I don't want to re-write the whole site. 我不想重写整个网站。

I have the repeater in a div with id="nav". 我在id为“ nav”的div中有中继器。 I added a css for nav: 我为导航添加了CSS:

#nav {
    text-align:left !important;
}

yet the repeater is still centered. 但是中继器仍然居中。 So I tried: 所以我尝试了:

#menuRepeater 
{
    float:left;
    text-align:left !important;
}

It's still centered. 它仍然居中。 Damn IE. 该死的IE。 Ideas? 有想法吗?

我不知道什么是asp.net中继器,但是在IE中,如果您使用边距规则( margin: 0 auto )将块级元素居中,则父元素需要具有text-align: center

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM