CSS Question
November 1, 2004 12:09 PM   Subscribe

CSS Question: I have an absolutely positioned div yet in IE (mac), it's horizontal position is centered and changes according to browser width. (code inside).

The CSS reads:

position: absolute;
top: 85px;
left: 17px;

It works fine in Firefox and Camino but not in IE. Any idea what's going on?

posted by dobbs to Computers & Internet (12 answers total)
Make sure your doctype is sending IE into strict mode. If it still doesn't work, add this to the body:

< !--[if ie]>Get Firefox.< ![endif]-->
posted by Tlogmer at 12:47 PM on November 1, 2004

Response by poster: Dunno much about doctypes. Mine reads:

< !doctype html public -//w3c//dtd xhtml 1.0 strict//en http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd>

Is that correct?
posted by dobbs at 12:54 PM on November 1, 2004

IE on Mac is pretty buggy, css-wise. You might want to reconsider the time it takes to swat this down.

Check your referrers. Do you have many visitors using IE on Mac? Will it totally break the page if you just let it be?

If you really are determined to fix it, start here.
posted by sageleaf at 12:57 PM on November 1, 2004

Oh, it's Mac. I was sitting here actually thinking about this, then safeleaf pointed that out.

I think you should decide whether you need to support IE Mac for that layout feature; if so, then think of another way to do it. Even if you can figure out how to make this work on the version you have in your dev environment, it may well fail in other versions -- it's that inconsistent.

I can think of a bunch of ways to make something position like that which ought to work in IE Mac, but without seeing the specific layout or knowing where you stand with regard to the Gospel Of Web Standards, I wouldn't know where to begin.
posted by lodurr at 2:10 PM on November 1, 2004

sorry, "sageleaf"
posted by lodurr at 2:10 PM on November 1, 2004

The doctype looks fine to me (I'd second sageleaf).
posted by Tlogmer at 2:12 PM on November 1, 2004

Silly question: Is "naverpi" the name or ID?
posted by lodurr at 2:12 PM on November 1, 2004

Response by poster: Hmm. Well, thanks for the suggestions, folks. The problem is that I don't have a windows box to see if it's a Mac problem only.

I can't run stats to see if anyone's using IE/mac as the site hasn't launched yet.

lodurr, it's the ID. So the code says {div id="naverpi"}stuff{/div}, but with greater/less thans instead of curlys.

Overall... my code is correct, right?
posted by dobbs at 2:36 PM on November 1, 2004

Put quotation marks around the attributes in your DOCTYPE (e.g.,
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">),
but that won't fix anything.

Try setting the width in pixels for the element (if you know it). IE5Mac has a problem figuring out how wide things are. Absolutely positioned elements should only be as wide as their contents if no width is set. IE5Mac doesn't do that so well.
posted by yerfatma at 3:04 PM on November 1, 2004

Response by poster: Thanks, Ma! That did it!
posted by dobbs at 3:21 PM on November 1, 2004

IE Mac is still at 5.2, right, and will never be updated? It's not really the browser of choice to validate for the Windows platform.
posted by ikkyu2 at 5:21 PM on November 1, 2004

No, it definitely has nothing to do with the Windows version. Not even the same codebase (AFAIK).
posted by yerfatma at 2:41 PM on November 2, 2004

« Older What U.S. network will have fair, non-partisan...   |   Free & easy partition manager for OS X? Newer »
This thread is closed to new comments.