3 ms·
Advice on CSS you'll wish your mother told you
- kilian 16y agoIf your first tip consists of a technique that has no effect on IE<8 (as it doesn't support the inherit value) and don't mention it, then the article is worth nothing. Looking at the rest of the 'advice', I'd say that's a reasonable conclusion. Skip this article.
- JeffJenkins 16y agoI found one or two to not be so bad: > Elements can take more than one class This is pretty worthless for anyone who has ever looked at CSS. What's less obvious (and the article doesn't mention) is that you can select elements with more than one class using .classA.classB > Relative and absolute addressing represent powerful magic This is really, really important. But the article doesn't explain it well at all. Read this if you're interested: http://www.barelyfitz.com/screencast/html-training/css/positioning/ http://www.barelyfitz.com/screencast/html-training/css/posit...
- kilian 16y ago> What's less obvious (and the article doesn't mention) is that you can select elements with more than one class using .classA.classB ...Except in IE6. It's great otherwise. Relative and absolute positioning (and floats and display values) are the hardest parts of CSS. I wrote a three part explanation about it two years ago that also explains CSS's concept of "flow": http://kilianvalkhof.com/2008/css-xhtml/understanding-css-positioning-part-1/ http://kilianvalkhof.com/2008/css-xhtml/understanding-css-po...
- fr0man 16y agoWhat is it with all the CSS articles/tutorials out there that rely on functionality that won't work in IE? I loathe IE with the fiery passion of a thousand suns, but if your tutorial for an image-free drop shadow technique won't work in it, you're wasting my time. 90% of my end-users use some form of IE.
- rimantas 16y agoMaybe that means that those arcicles/tutorials are not for you or your end users. Elsewhere in the world IE has less than 50% share. Also, maybe those articles/tutorials are not assuming that everything should look the same in every browser. Maybe some are happy to have rounded corners, drop shadows in better browsers and think it is acceptable to provide square corners and no shadows for IE. http://dowebsitesneedtolookexactlythesameineverybrowser.com/ http://dowebsitesneedtolookexactlythesameineverybrowser.com/
- fr0man 16y agoThat's fine, but don't sell your tutorial as 'works in every browser'. The article is giving CSS hints that just won't work in IE<8 (and frankly, I've had very sketchy luck with 8 as well). That creates more work than it saves in some cases. Where has IE fallen below 50%? I'd like to move there.
- pohl 16y agoI think there are many uses for CSS (like a drop shadow) where your site should work just fine without it, and those who choose to use a better browser are rewarded with something that looks better. I believe the shorthand term for this concept is "degrades nicely". If more sites took advantage of that point of leverage, we could collectively speed the demise of broken browsers, and we wouldn't have to continue this debate into my autumn years.
- fr0man 16y agoI'm all about that, but quite a few of the jQuery plugins I've tried to use lately just flat break things in IE<8. I've had to back quite a few changes out.
- robin_reala 16y agoFinally, a CSS submission to Hacker News that has modern, and more importantly good practise suggestions. More of these please!
- emehrkay 16y agoCss selector precedence http://www.google.com/search?client=safari&rls=en&q=css+selector+precedence&ie=UTF-8&oe=UTF-8 http://www.google.com/search?client=safari&rls=en&q=...
- jackrabbit 16y agoThis is an awful article... The author should learn about CSS shorthand for a start..