3 ms·
> Using tables for layout was the original hack. A simple and practical hack that worked (and continues to work) identically across all browsers without the ne
by nikatwork 11y ago
> Using tables for layout was the original hack.
A simple and practical hack that worked (and continues to work) identically across all browsers without the need for elaborate edge case code.
I'm curious, with the new libraries, can CSS yet do:
<table width="90%" align="center"><tr valign="middle"><td width="20" valign="top">menu</td><td width="100">leftcol</td><td width="*">content</td></tr></table>
- akie 11y agoEhm, yes?
- nikatwork 11y agoYeah, nah. Prove me wrong. I double dog dare you. Your answer must be cross and backwards compatible to count.
- olavk 11y agoThe display:table css properties are exactly equivalent to the display model of html tables. They were specified in CSS2 which became a recommendation in 1998, which is 17 years ago (!). But due to the IE6 dominance and abandonment it took many years before this part of css was broadly supported by browsers, so developers had to either use html tables (even when not semantically appropriate) or use hacks like floats (which was not designed for this) to achieve a table-like layout. So the age of hack was due to browsers not supporting css, not to to deficiencies in css as such. That said, html tables never displayed identically across browsers before css. There were lots of corner cases e.g. with the interaction of fixed and flexible columns. Which is not really surprising since the display model for tables were never specified in the first place before css.
- nikatwork 11y ago> display:table The delicious irony is that CSS had to emulate the old table model to overcome its default layout deficiencies. And IIRC it still can't natively handle mixing relative and fixed widths, and consistent vertical centering. > html tables never displayed identically My bread and butter used to be slicing photoshop comps into websites. My table layouts were pixel perfect on every browser without hacks. I do agree there were a few things that had to be accomodated using and spacer gifs - but it was painless compared to elaborate and fragile CSS hacks. I shouldn't still care about this stuff - I moved to IOS dev thank goodness - but I still nuture a burning hatred of CSS years later :)
- olavk 11y agoThere is no irony. CSS replicate the table layout model in order allow you to separate markup from presentation but still be able to show tables. Otherwise, how should the default style sheet for table-elements look? CSS obviously needed to to have at least the same presentational power as presentational HTML to be backwards compatible.
- Tiquor 11y agoI think CSS is wonderful, but the real tragicomedy is Bootstrap and Foundation grids which have CSS classes and Divs that are just as much management and just as much code as tables yet are very arguably less functional. Reliable vertical centering anyone? Now can you do it without wierd hacks?