CSS Techniques I Wish I Knew When I Started Designing Websites
noupe.com
noupe.com
html {
overflow-y: scroll;
}
This puts the scroll bar on the right of the page regardless of whether or not the page needs to scroll.
I hate watching my page bump 20px to the left just because I went from a page that didn't scroll to a page that did.
<!--[if IE 6]><body class="ie ie6"><![endif]--><!--[if IE 7]><body class="ie ie7"><![endif]--><!--[if !IE]>--><body><!--<![endif]-->
This applies "ie" and version-specific classes to the body tag in IE browsers. Therefore, if something about a button tag doesn't look right in IE in general, I can use the ".ie button" selector to apply a fix right below my button styling. If it's just IE 6 giving me grief, I can use the ".ie6 button" selector.Apparently I need to start doing that. Like, yesterday.
I found that my CSS skills really improved when I added a style reset and was forced to contemplate all the styles which were previously given to me without consideration by the browser.
This does not mean "never do browser testing" -- you should (and you should do it smartly, based on what's known about both the browsers and your demographics) -- but it does mean that you're less likely to get caught with your pants down.
Also, for my money, the best regime out there for classifying browsers and organizing a testing system is Yahoo's graded browser support. And oddly enough, they seem to like resets...
A reset stylesheeet gets rid of those. I don't start a site w/o one.
EDIT: or full overhaul of an existing site.
http://www.flownet.com/ron/css-rant.html
(How do you do links in HN comments? Markdown syntax doesn't seem to work.)
2. Yes.
CSS still has the advantage over tables of better separating content from presentation. A big problem with CSS is it's still awkward to deal with layout, so it's somewhat understandable some people just prefer to give up and use tables.
On the other hand, 2003 was the last year when I did layout using table. I did pixel-perfect cross browser layouts with CSS five years ago, and they had to work in IE5 back then. So yes, I do know what I am talking about and stand by my position.
Using just semantic markup, or with lots of divs within divs that have no justification to be there except to allow styles to be attached to them?
"Great pyramids of DIV" based layout is at most marginally better than table based layout.
(or, in the case of the particular HN username here, people who'd like you to think they know all the differences between multiple Lisp families and multiple implementations within families)
Seriously that's the lamest sort of reply we see here on Hacker News. Sniping other peoples work is low (this isn't Slashdot).
While we're on the subject of adding little value, the impression I got from the article was that this was yet another Top-10 style compilation of commonsense that you could find on other sites like A List Apart. Instead, I would prefer to read more about the OP's actual experiences and growth, i.e. something unique and original.
There is nothing troll-like about criticism, particularly when an improvement is suggested. Instead, I would look towards yourself and your "Slashdot" witch-cry.
For reference i'm slowly building up articles about things I don't pretend to be an authority on which you can happily attack in due course.
html:
<div class="300pixelbox"> <div class="padding"> This is 300 pixels wide and has 10px padding. </div> </div>
style:
.300pixelbox { width: 300px; }
.300pixelbox .padding { padding: 10px; }