Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I don't understand why people write CSS this way...
#6
[quote ka jowct]It depends on how well you have thought out the appearance of the site and how efficient you want your code to be. I much prefer the first way of doing things: combining whatever CAN be combined into a single rule.
Funny that we think so differently.

On this one, I guess it depends on what the site is for. I do a lot of ecommerce & promotional sites. There's always a different push, so that means there will always be changes. I find Example #1 to be extremely inefficient because it takes a lot of time to make changes or to get a new person familiar with the code (or even to remind myself how it was written.)

Also, I never, ever set type sizes in px anymore, unless I am asked to do so by a client who does not know much about CSS. Otherwise, I always use ems. It's more flexible and fluid. That way of setting type sizes (relative rather than fixed) is recommended by people like Dan Cederholm and Charles Wyke-Smith, among others, and it works very nicely if done correctly.

I always use px. It ensures that the design & layout of the site remain intact. The purpose of the sites (at least that I typically work on) is to convey a message to the user. Losing control of how the typography flows can completely change the message. I will provide a method for users to adjust type sizes on the site - still using px - before I'll allow a browser to miscommunicate my message.
Reply


Messages In This Thread
Re: I don't understand why people write CSS this way... - by M A V I C - 09-13-2007, 06:35 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)