CSS selectors on dimensioning with a value 0 should have no unit.
Examples:

padding: 0px;
should change to
padding: 0;

border: 10px 3em 0px 0px;
should change to
border: 10px 3em 0 0;

What this change achieves:
- code brevity: 0 is 0 in any unit

Note: this change pertains to all css files in all core installs / themes / theme engines.

Comments

pfaocle’s picture

Version: 4.7.0-rc3 » x.y.z

This is, AFAIK, standard practice for CSS. The downside, I guess, is remembering to put a unit back in if the value changes from 0...

Opinions? Will roll some patches if people think this is a worthwhile tidy up.

figaro’s picture

I'd like to reverse the argument: it is not about remembering to put something back in which is needless in the first place, it is about leaving something out. http://www.w3.org/TR/REC-CSS1#units

figaro’s picture

For the record, I have applied the aforementioned changes in the bluemarine theme and the friendselectric theme. I do not have CVS clients installed, but if agreeable, I can send the files or leave a link to those files.

heine’s picture

Units on zero values are optional. This doesn't translate into "shouldn't".

To create patches, check the chapter Patches in the handbook. Hope that helps.

pfaocle’s picture

Units on zero values are optional. This doesn't translate into "shouldn't".

Agreed, but squeezing out some 'optional' bytes from the various CSS files wouldn't hurt, either :)

pfaocle’s picture

Status: Active » Needs review
StatusFileSize
new1.13 KB

Had a quick gander - most 0 values in drupal.css are already specified without a unit. Here's a patch which removes the few 0 values with a unit.

drumm’s picture

Status: Needs review » Active

Committed to HEAD.

Please close if this is all, or add patches for the other CSS files.

Also please document where appropriate (if anywhere).

pfaocle’s picture

StatusFileSize
new1.69 KB

Pushbutton CSS.

pfaocle’s picture

Status: Active » Needs review

I think that is all.

drumm’s picture

Status: Needs review » Fixed

Committed to HEAD.

rstamm’s picture

Status: Fixed » Needs review
StatusFileSize
new7.71 KB

Sorry to open this again but i found more in the css files.

The patch

  • delete zero units
  • add 1 missing length unit
  • change RGB notation into three-digit form if possible, no mix of three-digit and six-digit forms of the same color
  • change margin and padding properties into one or two value form if possible
pfaocle’s picture

Category: feature » task
Status: Needs review » Reviewed & tested by the community

Looks good to me. Patch applies cleanly to current HEAD, all changes look fine. No adverse affects in core themes, as far as I can see.

drumm’s picture

Status: Reviewed & tested by the community » Fixed

Committed to HEAD.

killes@www.drop.org’s picture

also to 4.7

Anonymous’s picture

Status: Fixed » Closed (fixed)