Banner Logo
Home
The Real Kato
About Me
Twitter
Facebook
Frozen Lunches
Links
Kottke
Daring Fireball
Amalah
Secret Agent Josephine
Dooce
Contact



Archives
Most Recent

2024 April
2007 May
2007 April
2007 March
2007 February
2007 January
2006 December
2006 November
2006 October
2006 September
2006 August
2006 July
2006 June


Categories
All Categories 

bloggers 
books 
commentary 
dating 
food 
funnyhaha 
interesting 
life 
movies 
music 
politics 
reviews 
science 
site-business 
sports 
style 
techwatch 
television 
theater 
travel 


Recent Comments
On College Football 2022: Week 6 Recap and Week 7 Pre...
Ken said:
Yeah, we've both had our share of hope and disappointment in this game. Let's just hope for a good b...
On College Football 2022: Week 6 Recap and Week 7 Pre...
Dan* said:
I'm not sure how I feel about this game. On one hand, I feel pretty optimistic that we have the tale...
On College Football 2022: Week 1 Preview
Dan* said:
Glad to see you'll be back writing football again, Ken! Congrats on the easy win today. You didn't ...
On College Football 2021: Week 10 Recap and Week 11 P...
Ken said:
Yeah, sorry one of our teams had to lose. I've come to appreciate Penn State as a classy and sympath...
On College Football 2021: Week 10 Recap and Week 11 P...
Dan* said:
Hey Ken, congratulations on the win yesterday! Some really odd choices by our coaching staff in that...


<< Previous: In the News | Next: More Pseudo-Science >>

CSS Irritation
Friday, 2007 May 4 - 8:06 am
Who out there is a web designer? Maybe you can relate to this statement: whoever wrote the spec for CSS DIV positioning should be shot.

For those of you who aren't web designers, a DIV on a web page defines a box. In the cascading style sheet (CSS) for the web page, you can define where on the web page that box is supposed to appear. With me so far?

There are four ways you can define a box's position: static, absolute, relative, and fixed. The reason I say the spec writers should be shot is because "static" actually means "dynamic", "absolute" means "relative", "relative" means "offset", and "fixed" means "floating".

See?

Let me explain. "Static" means the box should appear in the flow along with other web content. So that's not static at all; it can change dynamically depending on the size and style of other content. "Absolute" means the box should appear at a position relative to the nearest positioned box (either a containing DIV, or the web page). "Relative" is like "static", but the box is moved by a defined offset from where it would normally appear. And "fixed" means when the web page moves, the box still appears at the same position on your screen (so it appears to float... this is how a lot of pop-up ads are done nowadays).

With regards to "absolute", there's another irritation. Normally when you define a position for a DIV, you put a "position:" attribute in the style definition for that DIV, and that's it. But when it comes to "absolute", that makes the box's position dependent on its own position attribute as well as the position attribute of the containing (parent) DIV. If none of the containing DIVs has a position (or if they're defined to be "static"), the box is positioned relative to the web page. If a containing DIV does have a position, the box is positioned relative to it.

Confused yet? See, this is why I'm so irritated. If I were writing the spec, I would define four position types: "inline", "parent", "page", and "window", and make them mean exactly what they say.

An excellent article on this topic is available on Austistic Cuckoo.
Permalink   Bookmark and Share
Posted by Ken in: site-businesstechwatch

Comments

There are no comments on this article.

Comments are closed for this post.
Login


Search This Site
Powered by FreeFind