Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> it's not worth "saving lines" to make your CSS harder to parse for someone who doesn't already know that you like to group X, Y and Z properties.

Well somewhat in between you could also put properties in alphabetical order as suggested in this Google Style Guide. That tend to work for me since "text" properties will be towards the end of the rule, and for me the layout properties like border, display, margin and padding is something I'd want to see first.

But where I prefer some freedom vs hard rules is that I'll also align properties to make the differences more obvious. In this YUI2 example, the second class is applied to a mobile version of the dialog, the common properties come first, that way the difference is obvious:

  /* dialog body wrapper for extra css styling (.rtk-skin-dlg .yui-panel .bd .body) */
  .rtk-skin-dlg .body { background:#fff; padding:10px; border-radius:3px; box-shadow:0 1px 3px rgba(0,0,0,0.2) inset; }
  .rtk-mobl-dlg .body { background:#fff; padding:10px; }


Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: