CSS - Absolute = 1, Relative = 0

He has: 578 posts

Joined: Jun 2004

Ugh! For some reason, this works:

.menu { position: absolute; left: 12px;}

and this doesn't

.menu {position: relative; left: 12px;}

I don't know why!

They have: 461 posts

Joined: Jul 2003

because px is an absolute measurement

relative measurements are em and ex
absolute measurements are in, cm, mm, pt, pc

measurements explained:
cm = centimeters (10 millimeters)
em = height of current font (1em = height of current font; 2.5em = 2 and a half times the current size of the font)
ex = height of the letter x in the current font
in = inches (1 inch is 39.something cenitmeters)
mm = millimeters
pc = picas (1 pica is 12 points)
pt = points (1 point is one-seventy-secondth of an inch)

POSIX. because a stable os that doesn't have memory leaks and isn't buggy is always good.

He has: 578 posts

Joined: Jun 2004

Thanks!

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

Using absolute positioning seems like a pancea, but it's not. Let it flow unless really necessary to set the position on a page.

Also, the previous response was wrong.

Relative means relative to the containing element. Absolute means relative to the browser window. It has nothing to do with unit measures.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.