关闭顶部展开顶部

CSS and the meaning of life_CSS教程

编辑Tag赚U币
教程Tag:暂无Tag,欢迎添加,赚取U币!
Wow, my little CSS screed seems to have really hit a nerve. In just six hours it has hit #6 on the Reddit front page (up to #5 now). I didn't even submit it to Reddit because it has been ages since I was able to get any traction over there! All those karma points, they could have been mine. Oh well.

I would love to respond to all the comments, but the volume is pretty overwhelming. But this one really stands out as my favorite:

Yes, you are an idiot.

Why mince words? I confess, I am not a CSS expert. I all but admitted as much in my piece, which is why I based my example on code that was not written by me, but by someone who holds themselves out as being a CSS expert. Maybe I'm so idiotic that I can't even tell a real expert from a snake oil salesman. But I submit that whatever the case, I am an very good company. The mere fact that the CSS wars have gone on for as long as they have is ample evidence that there are a lot of people out there who do not find CSS a model of intuitive clarity.

I don't want to re-fight the CSS wars here. Instead I want to focus on some things that surely we can all agree on, to wit -- that the CSS wars have been going on for a long time, that a lot of people have put a lot of effort into fighting them, and that very little progress has been made towards resolving the dispute -- and ask the following question: What conclusions can we draw from these observations?

One possibility, of course, is that one side is right and the other side is wrong, and that the people on the wrong side are simply dim-witted or intransigent, or both. I try (not always successfully) to take seriously the possibility that I could be wrong whenever I write anything. Maybe Dr. Howard R. Fine is right and I really am an idiot. One of the many problems with idiocy is that it does not yield readily to introspection. I take some comfort from the fact that the vast majority of the people accusing me of idiocy don't actually dispute any of the points that I made. But maybe I'm such an idiot that I'm not even worth educating (hard to tell from where I'm sitting). So the best I can do is to leave that on the table as a possibility and move on to the next option, which is, I believe, if it not a more plausible hypothesis, at least more promising as a potentially productive line of inquiry.

I humbly submit for your consideration the possibility that different people want different things out of life. It seems self-evident, but it can sometimes be surprisingly hard to wrap your brain around the fact that someone else doesn't want the same things you do. One person wants long-term maintainability while another just wants to get it done as quickly as possible. One person wants their web site to be accessible to blind people, another doesn't. One wants SEO, another doesn't care.

Underlying my conclusion that tables were the way to go was a tacitly assumed quality metric that not everyone shares. At the time I was writing I was not even consciously aware of some aspects of my own quality metric. For example, accessibility to the blind had not even entered my mind. It's just not something I have ever had to deal with, and about which I know next to nothing.

There are other aspects of my quality metric about which I was aware, but about which I was not explicit. For example, I tacitly assumed that having content spill out beyond the boundaries of its containing DIV is Bad. I think most people would agree on this and other tacit aesthetic judgements that I made, but not all would. A blind person, for example, couldn't care less where on the screen something ended up. (I'm actually guessing about this. I really know very little about how blind people navigate the web. Maybe someone can enlighten me.)

There are likewise tacit aspects of other people's quality metrics that manifest themselves in their comments. For example, a lot of people seem to think that anything that was done in the 1990's is automatically bad. It is certainly true that tables can be, and during the 90's often were, badly abused. But IMO that is no reason to throw out the baby with the bath water. It's overreactions like that that led to throwing out Lisp with the rest of AI during the 80's, a mistake from which computer engineering is still not fully recovered.

And then there is one element of my quality metric which seems to be at the heart of the controversy: I believe that computers are meant to serve people and not the other way around. That means that if something inherently simple is difficult to do, it's wrong.

Not everyone agrees with this. A surprising number of people like things to be difficult. I have never understood this, but it is a fact. Some people revel in the intellectual studliness of mastering, say, C++ template programming or x86 assembler. I don't. I think C++ is a pain in the ass. Life is short, and I would rather spend my allotted time skiing or making love to my wife than worrying about whether or not I need to define a virtual destructor in my base class in order to avoid memory leaks. And that means that when I want, say, for something to appear centered on the screen, I want to be able to do it by typing "center" rather than "margin:auto". If I can't tell a computer to center something by saying "center", then as far as I'm concerned the computer is wrong, not me.

Like I said, not everyone buys in to this worldview. I don't get it, but it is surprisingly common. I think it might have something to do with job security. I first encountered the complicated-is-beautiful mindset when I was working for NASA. I had an idea for how to simplify spacecraft sequencing and make it less error prone. I figured everyone would love it. To the contrary, the establishment fought the idea tooth-and-nail (and still does to this day). And this attitude is everywhere. It's the reason the tax code is so fucked up. It's the reason the law is so byzantine. It's the reason that languages like C++ and Perl thrive.

I like simplicity. I think the computer should have to conform to my brain and not the other way around. That's why I like tables. They are simple, and they work -- for some value of "work".

Different people have different ideas of what it means to "work". For me, the ratio of effort expended to the quality of the visual appearance on the screen is paramount. I want to put forth as little effort as possible to get something that looks decent. (Yes, I'm a lazy bum. It's my greatest strength. Laziness is a powerful motivator for finding more effective ways of doing things, and it has served me quite well.) Everything else is secondary. I don't have any blind customers. I am not in any business where SEO really matters all that much. But your situation, of course, could be different.

That said, I do believe that some of the things said in favor of CSS and against tables are just flat-out bogus, and to point out some of those was the purpose of my essay. CSS is touted as separating layout from content. It doesn't. Maybe with the new table layouts in CSS3 that will change, but one of the external constraints that I have to live with is that what I do has to work in IE6. While the popularity of IE6 is mercifully in decline, the sad fact of the matter is that it still has a significant market share, and I am not in a position to ignore that much as I would like to.

Another common thread is that "tables are for tabular data, not layout." Why? Just because they are called tables? Here's a news flash: HTML has no semantics beyond how it is rendered! (That's not quite true. Links have semantics beyond their renderings. And maybe label tags. But nothing else in HTML does.) This is the reason that the "semantic web" is still a pipe dream. HTML was supposed to have semantics, but it doesn't. Giving real semantics to a markup language is really really hard. The history of computer science is lousy with failed attempts, from KRL to SGML.

Finally, a lot of people pointed to the Zen Garden as evidence of CSS's power. I remember seeing the Zen Garden for the first time and being blown away. But if you look closely you will see that it's not really CSS that makes the Garden beautiful, it's images! Don't get me wrong, the Garden is lovely, occasionally spectacular. But how much of the loveliness is due to CSS and how much is due to photoshop is far from clear. And this is to say nothing of the fact that the Garden completely sidesteps one of the most thorny issues for CSS, namely, dealing with dynamic content. If you know ahead of time what your content is going to be it's not hard to write CSS that will make it look nice. The challenge is writing CSS that looks good if you don't know ahead of time what your content is going to be. The Garden, beautiful as it is, has nothing to say about that.

I want to point out one more thing: I am not bashing CSS. I like CSS. Its goals are the right ones, and in many ways it is well executed. You can do some really cool things with it, often without having to work very hard. But layout -- at least the three-column layout that everyone seems to want -- isn't one of them.

来源:52CSS//所属分类:CSS教程/更新时间:2012-06-13
loading.. 评论加载中....
相关CSS教程
闂備焦鐪归崺鍕垂闁秵鍋ら柡鍥舵緛缂嶆牠鏌涢埄鍐姇闁抽攱甯楅妵鍕即濡も偓娴滄儳顪冮妶蹇曠Ф闁瑰嚖鎷�
婵犵數鍋涢顓熸叏椤撱垹纾婚柟鐐灱濡插牓鏌¢崒婵囩《濠⒀勭⊕娣囧﹪鎳犻澶嗗亾濠靛鐓熼柕蹇婃櫅閻忔煡鏌熼崙銈嗗
婵犵數濮烽。浠嬪焵椤掆偓閸熷潡鍩€椤掑嫷妫戠紒杈╁仜椤撳吋寰勭€n亝顓鹃柣搴f嚀鐎氼厽绔熼崱娆愬床濞戞柧绶氶弻锝夊閳轰胶浼堥梺鐟板殩閹凤拷
婵犵數濮烽。浠嬪焵椤掆偓閸熷潡鍩€椤掑嫷妫戠紒杈╁仜椤撳吋寰勬繝鍕靛悑闂備浇顕栭崹搴ㄥ礋椤撗勑氶梻浣筋嚙闁帮絽岣胯铻炴繛鎴欏灪閸嬪鏌ㄩ悤鍌涘
闂傚倷鑳舵灙缂佺粯鍔欓獮濠冩償閵娿儳鍔﹀銈嗗笒閸婂摜鏁崼鏇炵閻庢稒岣块惌鎺斺偓瑙勬礃缁诲牓寮幘缁樻櫢闁跨噦鎷�
闂傚倷鑳舵灙缂佺粯鍔欓獮濠冩償閵娿儳鍔﹀銈嗗坊閸嬫捇鏌涘顒夊剳缂侇喖锕弫鍌炲礈瑜忛悡鎾绘煟鎼搭垳宀涢柡鍛箞閹苯鈻庨幋鐘碉紳婵炴挻鑹鹃敃銉р偓姘炬嫹
闂傚倷娴囬妴鈧柛瀣尰閵囧嫰寮介妸褉妲堥梺浼欏瘜閸o綁寮诲☉妯锋斀闁归偊浜為懗铏圭磽娴i潧濡芥俊鐐舵椤曪綁濡搁埡濠冩櫖濠电偛妫欓崹鐢电箔閿熺姵鈷戦柛婵嗗閳ь剙顭烽獮濠囧箻閼告娼熼梺璺ㄥ櫐閹凤拷
闂傚倷绀侀幖顐﹀疮閻楀牊鍙忓瀣捣缁€濠傤熆閼搁潧濮堥柣鎿勭秮閹娼幏宀婂妳濠电偛鐪伴崐鏇㈡箒闂佹寧绻傚Λ娆戠矆閳ь剟姊洪崨濞氭垿鎮ч悩鑼殾闁规壆澧楅弲鎼佹煥閻曞倹瀚�
濠电姷顣藉Σ鍛村垂椤忓牆绀堟繝闈涙-閻斿棙淇婇姘倯閻庢氨绮妵鍕箻鐎靛摜鐣洪柣搴㈢啲閹凤拷
婵犵數濮烽。浠嬪焵椤掆偓閸熷潡鍩€椤掑嫷妫戠紒杈╁仜椤撳ジ宕堕妸銉紩婵$偑鍊栭幐鑽ゆ崲閸愵亖鍋撳铏彧濞e洤锕、娑樜旈埀顒佹櫠閸欏绡€妞ゎ偒鍠楃€氾拷
濠电姷顣藉Σ鍛村垂椤忓牆绀堟繝闈涙-閻斿棙鎱ㄥ璇蹭壕閻庤娲﹂崜鐔笺€佸▎鎾崇闁绘挸绨堕崑鎾绘偨閸涘﹦鍘搁梺鍓插亝缁诲嫬鐡┑鐘愁問閸n垶骞忛敓锟�
濠电姷顣藉Σ鍛村垂椤忓牆绀堟繝闈涙-閻斿棙鎱ㄥ璇蹭壕闂佸搫鑻幊姗€宕洪埀顒併亜閹哄棗浜鹃梺瀹狀嚙闁帮綁鐛幋锕€绠涢梻鍫熺⊕椤斿棝姊绘担鍛婃儓閻庢碍鎮傞獮蹇涙晸閿燂拷
濠电姷顣藉Σ鍛村垂椤忓牆绀堟繝闈涙-閻斿棙鎱ㄥ璇蹭壕閻庤娲╃紞渚€鐛€n亖鏀介柛顐亗缁憋拷
婵犵數濮烽。浠嬪焵椤掆偓閸熷潡鍩€椤掑嫷妫戠紒杈╁仜椤撳吋寰勬繝鍕幀闂備胶鎳撻悺銊ф崲閸曨垼鏁傞悗娑櫭肩换鍡樸亜閺嶎煈娈斿褍寮剁换婵嬶綖椤旇棄顏�
闂備浇顕ф鎼佸储濠婂牆绀堟繝闈涱儐閸嬪鏌熼幆鐗堫棄闁活厽顨呴埞鎴︽偐閹绘帗娈梺濂告涧缂嶅﹪寮婚妶澶嬪殟闁靛鍎遍~宥夋⒑缂佹ḿ澹勭紓宥勭閻e嘲鈻庨幘瀛樻闂佽法鍣﹂幏锟�
UB闂傚倷绀佸﹢杈╁垝椤栫偛绀夋俊銈呮噽瀹撲線鏌涢妷銏℃珕閻庢碍宀搁幃妤€鈽夊▍铏灴閿濈偤鏁撻敓锟�
闂傚倷娴囨竟鍫熴仈缁嬫娼栧┑鐘崇閻掗箖鎮楅悽鐢点€婇柛瀣崌閻涱噣宕归鍙ョ棯婵犵數濮崑鎾绘煥閻曞倹瀚�
闂備浇顕ф鍝ョ不瀹ュ鍨傞柛婵嗗閼板潡鏌涢姀銏犳
闂傚倷绀侀幉鈥愁潖缂佹ɑ鍙忓瀣捣缁€濠傤熆鐠鸿櫣鐏遍柛妤佺缁绘盯宕卞Δ鈧銏ゆ煕閻愬樊妲圭紒缁樼〒缁辨瑩鎮╅崫鍕腐闂備胶枪妤犲繘骞忛敓锟�
缂傚倸鍊搁崐鐑芥倿閿曞倹鍋¢柨鏇炲€搁崹鍌涚節婵犲倸顏い鈺呮敱閵囧嫰骞掑鍥舵М缂備焦褰冨﹢閬嶅焵椤掑倸浠柛濠冪箘缁辨挸顫濇0婵囨櫓闂佽法鍣﹂幏锟�
©2017 www.mb5u.com濠电姷顣藉Σ鍛村垂椤忓牆绀堟繝闈涙-閻斿棙鎱ㄥ璇蹭壕閻庢鍣崳锝夊箖閳哄懎绠甸柟鐑樻尭閻︼拷
闂傚倷娴囬妴鈧柛瀣崌閺岀喖顢涘⿰鍐炬毉濡炪們鍎婚幏锟�&闂傚倷绀侀幉锛勬暜閹烘嚦娑㈠籍閸噥妫呴梺璺ㄥ櫐閹凤拷