开发者

advertisement won't center in ie unless body is text-align:center

I have an advertisement that loads a script, and its inside a centered div. No matter what I do ie6, ie7, and ie8 won't center it unless body has

text-align:center;

Right now the css for the div is set like this, which works only on chrome/firefox:

#header{
    width:730px;
    margin:0px auto;
    text-align:center;}

I tried using .g开发者_开发百科etScript with a chain like this:

.css('text-align', 'center');

But the script won't load externally in chrome and it then sets the CSS for the entire page to the width of the script. I also tried putting it in an html page and loading that with jquery inside of a centered div, but it just sits on the left side of the page.

I also tried waiting till $(document).ready and then centering the div, but that didn't work either.

The main problem is all of the text in the page isn't wrapped by any other div where I can align the text left, and this is being applied to about 1000+ web pages.


To clarify: is there nothing wrapping the content other than ? If not, just text-align center on the body, use margin 0 auto on the ad div as Jules suggested, and text-align left on the content. If your DOM is lacking anything around the content, you may have to live with a compromise.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜