Give me a break. More than half these "mistakes" involve stylesheet writers NOT saving a few bytes. Redundant Units? I would rather spend the 4 bytes to improve readability. At one point, the author recommends the rgb(255,255,255) format for specifying color along with the #ffffff hex format. Count the bytes!
This list would make more sense if it were detailing techniques you might use to process your stylesheet into a production file while retaining the original for maintainance.
These tips make as much sense as recommending to the content writers not to use 5 letter words when a 3 letter word would do, because you'll save 2 bytes per page load that way. Sometimes readability is more important.
Having readable, maintainable CSS is not a mistake. I'm surprised the author didn't list having comments as a mistake, since they add additional bytes to the download.
I was expecting real mistakes, such as using CSS class names like "red_subheading" or "left_menu" in which the name implies how the presentation will be. I see this all the time. What if I want to move the menu to the right? I can either change all the HTML to read "right_menu", or I can have "left_menu" be on the right. Either is dumb. Better to just name it "main_menu" (if it really is the main one) and then the CSS can even make it a horizontal menu at the top or bottom.
Comments
bonlebon replied ago:
I was looking for something like this a long time ago, thanks.
dpm1661 replied ago:
Give me a break. More than half these "mistakes" involve stylesheet writers NOT saving a few bytes. Redundant Units? I would rather spend the 4 bytes to improve readability. At one point, the author recommends the rgb(255,255,255) format for specifying color along with the #ffffff hex format. Count the bytes!
This list would make more sense if it were detailing techniques you might use to process your stylesheet into a production file while retaining the original for maintainance.
These tips make as much sense as recommending to the content writers not to use 5 letter words when a 3 letter word would do, because you'll save 2 bytes per page load that way. Sometimes readability is more important.
kdenehy replied ago:
Having readable, maintainable CSS is not a mistake. I'm surprised the author didn't list having comments as a mistake, since they add additional bytes to the download.
I was expecting real mistakes, such as using CSS class names like "red_subheading" or "left_menu" in which the name implies how the presentation will be. I see this all the time. What if I want to move the menu to the right? I can either change all the HTML to read "right_menu", or I can have "left_menu" be on the right. Either is dumb. Better to just name it "main_menu" (if it really is the main one) and then the CSS can even make it a horizontal menu at the top or bottom.
guymac replied ago:
Obviously you can setup your server to compress CSS, so there is no reason not to make it as readable as possible.
Voters For This Link (31)
Voters Against This Link (0)