Re: Feature request for CSS

Laurent,


I believe, and that is something to generally keep in mind, that you
will benefit from cleaning up your style sheet first. Without
bothering to improve the class names of your sample which are mostly
presentational and thus problematic from a maintainability point of
view [1] here’s what a simple update can do for you:

#banner, #left h2, #right h2, #footer ul {
  background:#363;
  color:#FFF;
}
#banner {
  font-size:120%;
  text-align:center;
}
.column1_2, .column2_2, .column1_1 {
  border:#363 solid;
}
.column1_2, .column2_2 {
  border-width:1px;
}
.column1_1 {
  border-width:3px;
}
#left h2, #right h2 {
  margin-bottom:.2em;
}
#left ul, #footer ul {
  list-style:none;
  margin:0;
  padding:0;
}
#left ul {
  background:#CC9;
  color:#000;
}
#footer ul li {
  float:left;
}

As you might notice, things got a bit simpler, and all of a sudden
you’re only dealing with 5 declarations that define colors of 4
different values (vs 9 and 4). I am not sure that this is not
manageable and absolutely requires variables or constants. The same
holds true for significantly more complex projects where there’s also
less need for variables but for craft [2].

The way your write your CSS truly goes a long, long way.


How convenient:

[1] http://meiert.com/en/blog/20090617/maintainability-guide/#toc-markup
[2] http://meiert.com/en/blog/20090401/why-css-needs-no-variables/

-- 
Jens O. Meiert
http://meiert.com/en/

Received on Tuesday, 17 August 2010 18:38:29 UTC