Web Design / HTML

  1. Home
  2. Computing & Technology
  3. Web Design / HTML
photo of Jennifer Kyrnin

Jennifer's Web Design / HTML Blog

By Jennifer Kyrnin, About.com Guide to Web Design / HTML since 1997

The CSS we love and the CSS we hate

Monday August 25, 2008
I found a fun post today on onderhond.com - HTML & CSS ups and downs. The idea is that like most of us, there are parts of building HTML and CSS Web pages that we love, and parts that we hate. Ironically, one of the things that I dislike the most about CSS I also like the most - specificity. This is the idea that the more specific your CSS selector is, the higher precedence it will have in what gets implemented. I hate this because when I'm not thinking about my CSS, I sometimes end up writing styles that are very specific (for instance div#main h1#headline). Then, when I want to use that style later on, I can't. At least not without rewriting the selector above. Tedious! But I love specificity too. I love it when I've been asked to make a widget or other change to a part of a page. Rather than trying to tease out the exact styles I need for that widget, I just set IDs and classes on my elements and make my style selectors insanely specific. Not pretty for the next person who comes along - but I do use a lot of comments. :-)

Comments

August 26, 2008 at 11:50 am
(1) Peggy Shields says:

I love the fact that CSS styles can be changed site-wide one time and the whole site is changed … but that can have an adverse affect on the site too if you aren’t careful. I love the increased speed of the site that is built with CSS.

I hate hacks to fix CSS for specific browsers. I refuse to use them because it could be a potential nightmare if the browsers started working properly and it makes for messy confusing code.

August 27, 2008 at 11:44 am
(2) Joseph says:

Well, I am still trying to gel in my own perspective what to use as a selector style, and when you open yourself to all the possibilities confusion can set in. I found this this morning:

font: bold 11px/18px “Lucida Grande”, “Trebuchet MS”, Arial, Helvetica, sans-serif;

That is not the way at all I would ever set up the font, I’m in a stupid form this morning. The point is I wish there was a best standard. It’s all over the place and for beginners it’s got to be very confusing. I’m intermediate with css.

February 10, 2009 at 7:53 am
(3) Dave Miers says:

I truly hate hacks and almost refuse to use them unless I’m desperate…lol. Most of the time there is a better and simpler way to do things that doesn’t require a hack and it usually more stable. Some people get so caught up in hacks that it would have been cleaner code just just use a table sometimes, but that’s rarely required except for email.

That really horrible descendent selector you mention your fond of, I hate those too, unless they are really needed. Usually a sign you have been using Dreamweaver or it’s templates for too long since it just loves those things.

I love CSSedit and external style sheets, it’s a whole new CSS experience, especially if combined with Coda. This combination makes it easy to author clean code in html and css. In fact when you make this kind of switch fromm a WYSIWYG editor looking at your previous code is just plain embarrassing. I love css plugins in Coda that will compress your css and combine things you have done that match in much more efficient code

Leave a Comment

Line and paragraph breaks are automatic. Some HTML allowed: <a href="" title="">, <b>, <i>, <strike>

Discuss

Community Forum

Explore Web Design / HTML

About.com Special Features

Web Design / HTML

  1. Home
  2. Computing & Technology
  3. Web Design / HTML

©2009 About.com, a part of The New York Times Company.

All rights reserved.