Don't Blame CSS For Your Incompetence
jemjabella.co.uk
jemjabella.co.uk
I think the fact that it took you (a CSS pro) 30 minutes to come up with a simple 3 column example that's hard for me to understand, reflects poorly on CSS. Just because something is possible doesn't make it a good technology automatically.
I might be able to make a Turing machine out of my blender, some rubber bands, and chewing gum (note: haven't actually tried this). It might be Turing complete, but I'm not going to be able to program anything useful with it (an admittedly extreme example)
Though the coupling between CSS and HTML is loose it's not quite loose enough to allow HTML to be arbitrarily reordered and maintain the same presentation without also modifying the CSS.
http://www.jemjabella.co.uk/junk/rearrange/abs-columns-in-or...
http://www.jemjabella.co.uk/junk/rearrange/abs-columns-out-o...
Same CSS, re-ordered columns.
Although for the record, I dislike the technique used to achieve the results. As the person above you said - just because it's possible it doesn't mean it's any good!
Is there a fun story behind your website's headline: "Jem Jabella - Ultimately Better Than You" ?
I use it as a measure of whether or not people should read my site... i.e. if you find it funny, or are able to ignore the blatant egotism, then you would probably be OK reading my site. If it winds you up or gets to you, then you won't like the content and you should read at your own risk. :)
I see.. :p
Could you explain the joke to me?
Not to mention the fact that he only tested in FF. The real nightmare starts when you have to make it look good on IE too.
I ask because I'm now at work, and have access to a windows box with IE6 installed. Lo and behold, my examples work EXACTLY the same as they did in FF3.
No nightmares involved. :)
There is only one way in CSS (without js) to do a layout where there are two fixed width side bars on either side and one center content area that grows/shrinks with the width of the browser window and that is the "out of order" way (two floats, one non-floating div with margin-left, margin-right equal to left,right sidebars' widths), which coincidentally, he also screws up via the use of relative positioning and 3 floats.
"You can order your content how your like. You are restricted only by your knowledge of CSS and not its ability as a styling language to render your documents. "
I will retract what I've said if you can demonstrate a fluid 3 column layout using only those 3 divs (left, right, center) where the center column expands with the browser, the sides remain constant width, and the order is preserved. This is trivial using tables.
Css tends to show its rough edges when you use it outside of a fixed width or absolutely positioned environment.
Afaik, the exact challenge you're proposing can be done with something like:
.a,.b,.c {position:absolute;} .a {left:0;width:200px;} .b {left:200px;right:200px;} .c {right:0;width:200px;}
Before anyone adds new requirements, consider these ones: it has to be emailed and in the printout, the columns should look like tabs above the midle area.
In all seriousness, sometimes requirements are inane, pointless and unreasonable and you just have to push back and say it can't be done.
I think CSS detractors tend to obsess over specific points that tables can handle normally, but often leave out real life situations where obsessive alignment is not necessarily the biggest of the problems. Bias (in this case towards css vs tables, as opposed to web dev in general) is an interesting phenomenon.
It's true that you can order the markup however you want and write the CSS to make it look right, but the key point is recognizing that (unless you position everything absolutely) there is still no true separation between the markup and the CSS (at least where layout is concerned). If they were truly independent, then it wouldn't matter what order the elements appeared in the markup... the CSS would lead them to render the same way on the screen every time.
It's worth pointing out that there is true independence between the markup and CSS where styling is concerned (and this is where CSS shines). If you style the background, font, opacity, whatever of a particular element and then move that element to a different location within the markup, the element will still look exactly the same (unless the new position in the DOM subjects it to other CSS rules that override the old ones).
I'm rambling a bit here, but all I'm really trying to say is that CSS has its place in the web development toolbox, but old-school tables often have the edge when looking for a layout that just works.
Another place where tables have the edge: when a new browser version comes out, css layouts are often broken, especially if they rely on hacks.
I always thought CSS worked well for decorating stuff, and not for layout. But, anyway, I almost always use CSS. The exception being: I need some quick layout where floats are screwed up and I don't feel like spending a whole day figuring out why (see above statement about its documentation).
Regardless, one thing that bothers me is when people claim that it's entirely your fault if you can't use something, because you didn't bother to learn enough about it. This is always true, but surely we all can agree that things have different levels of inherent difficulties. Adding, for example, is much easier than differentiating, though they both require you to learn it before you can use it. So when people complain about how CSS is not as simple as it could be, or that all the little nuances and exceptions are ridiculous, this is due to some mixture of ignorance and inherent complexity in CSS, and is not entirely the person not knowing CSS. This also applies to situations where rather than taking a criticism in stride, the answer is: "Don't like it? GET OUT."
I guess, in short, the attitude of "that's the way it works, deal with it" as being a valid argument for "you shouldn't be complaining" really pisses me off.
And mod-up "Regardless, one thing that bothers me is when people claim that it's entirely your fault if you can't use something, because you didn't bother to learn enough about it." A good language, a good system, a good process "makes easy things easy and difficult things possible". As far as I can see, CSS fails with both. And, today was the tipping point for me personally. I would have endorsed CSS yesterday.
Well, I know CSS is great if I want arbitrary rectangles place on the page.
Anyway, I agree... today I no longer fear using tables... and, fuck it, I'm bringing back <b> <u> and <i>.
Further, you test it in Firefox 3. The problem that I see is that in the Real World (TM), I must make sure that the website works on Internet Explorer 6. Most of the problems I encounter with CSS layout involves cross-browser inconsistency.
I do not pretend to be a specialist in front end work; frankly, it is my least favorite part of development. However, I've made an effort to learn CSS layout systems only to go back to tables in projects that someone else isn't doing the work.
Ref: real world - agree totally. However, as I said earlier today ( http://news.ycombinator.com/item?id=463712 ) you can't blame CSS for the flaws in IE.
As a designer, I just need my sites to work in the real world (where 1/3 of my traffic is IE6). I'm not placing any blame, but if it doesn't work in IE6 then it doesn't work for me.
* valign works
* cells are equal heights, dependent on contents
* if width of contents is too big, cells adjust and display it best they canI'll let the likes of Eric Meyer etc defend the rest of it. I'm sure they know more about it than I do anyway.
* Table-for-layout-ists is just too long, don't you agree? ;)
Really?
>Both are visually identical in appearance, both use CSS to control the positioning of the columns, but one is in "correct" logical order in the document (left, center, right) and the other out of order (center, left, right).
Really??
> (Only tested in Firefox3 on Linux.)
Ah, there it is. :)
BTW you have 4 w's in the url in your profile on HN.
Which is a straw man - nobody's arguing that it's impossible. The argument generally centers around valid, web-tested, academic-approved CSS layouts being practical for use in the real world. I worked with someone who did freelance web design on the side and who said "I program for Opera and only test in Opera." Does anyone really need to wonder why he didn't have any repeat business?
I also worked in a slicing sweatshop, and using CSS to do layouts instead of tables tripled the amount of time it took to slice a PSD mockup. Department-wide adoption of the YUI CSS framework brought this down to maybe double, although YUI still has some of the basic layout issues that CSS itself does (eg the lead engineer on YUI CSS told me himself that the only way they know of to solve the equal-height column issue with YUI is using Javascript, and there is no equal-height column CSS hack that's anywhere near to understand or cross-browser compatible as table-tr-td-td-td). The greatest time sinkhole by FAR was CSS layout debugging. It was not infrequent to have someone's whole day go down the drain struggling with some god-awful cross-browser issue that would be relatively easy using tables for layout. So I've been there, to the point where I know that the only CSS books that aren't nearly completely worthless are _CSS Mastery_, _Bulletproof Web Design_, and maybe O'Reilly's Definitive Guide.
Doing a layout in perfect, valid CSS separating presentation from content (as much as possible, because I've never seen them successfully completely separated in a non-trivial project) is sort of like writing a book and having a sticker on the cover that says "This book has been validated 100% grammatically correct." Swell, but it really doesn't have anything to do with the price of spinach.
Just like how the fact that many people have a beef with using CSS for layouts doesn't negate the fact that for everything else it eliminates redundancies and is generally the cat's pajamas, the fact that tables look ugly doesn't negate the fact that in many cases they Just Work faster and are easier to understand than CSS for standard layouts like three equal-height columns.
Your argument, perhaps, but that's not what the post was about.
But while your post was correct, it was a straw man - nobody makes the argument that it's impossible to do a markup-order-independent, three-column layout in CSS, especially when you only have to make it work in Firefox 3 on Linux and don't have to deal with equal-height column issues.
The argument that apparently half of HN is discussing now is "which is more pragmatically effective for client-acceptable layout: CSS or tables?" The post doesn't address this, because a layout that's only been tested in Firefox 3 for Linux would be completely unacceptable to any client I've ever done business with.
The first post I quoted did exactly that. The OP argued that if you changed the order of a 3-column layout, it 'destroys' the presentation. Both my first and amended examples proved this wrong.
I work in web development. I specialise in PHP but I do front-end work on a day to day basis. I too struggle with the frustrations that half-arsed browsers such as IE present. Please do not assume that because I chose the side of CSS on this occasion to demonstrate its capabilities, that I do not 'get' what the css vs. table / developing for IE arguments are about.
Not exactly; he took a "canonical" example of such a layout from an authority on the matter and showed that even with such an idealized example from such an ideal source, changing the order of the content breaks the output.
Also, your counterexample uses different CSS for the "in order" and "out of order" proofs-of-concept, which defeats the purpose - the point is that the CSS needs to stay exactly the same with the presentation not changing upon changes in markup order.
> Please do not assume that because I chose the side of CSS on this occasion to demonstrate its capabilities, that I do not 'get' what the css vs. table / developing for IE arguments are about.
I never said you didn't get it. I said you didn't address the relevant argument in your article. Your article is correct and well thought-out, but it doesn't address the argument that is dividing the HN community, pitting brother against brother.
I already addressed that; see the new URLs in a comment above.
And in my experience, for reasonable client-acceptable cross-browser compatibility (ie IE6/IE7/FF/Safari), CSS based layouts often cause more headaches than they're worth.
I appreciate your enthusiasm, but I'm sorry to say your assertive "No" doesn't negate the fact that my experience is that CSS-based layouts are very often not cost-effective compared to table-based.
We had 15 people doing slicing all day, every day, 50-60+ hours a week. We weren't all morons. You better believe we figured out what works and what doesn't, and as I said, the switch to CSS-based layouts tripled the time it took to get a site to a client. If you want to believe that everyone in the shop just happened to simultaneously become mentally retarded at the exact time the switch was made, you're free to do so. Personally, I think Occam's razor suggests otherwise.
The point is, choose whats best for you. For me CSS has worked!
Agreed 100%.
I assume I could change it myself (the edit link is there)...
Incidentally, the edit link has timed out now.
Ay, there's the rub, / For what in that tests of compatibility for bugs may come / When we have shuffled aroud this horrible mess of browser code / Must give us pause.
1) Blame ASM and use something more convenient like python, or
2) Blame my incompetence and soldier on?
Now replace ASM with CSS, python with tables, and word processor with complex webpage.