tags:

views:

57

answers:

3

I know two

  • margin {0 auto}
  • line-height: 1.5;

is there any other?

+2  A: 

I don't really have an answer for your question, but I just wanted to say that I don't think you should ever leave off the units unless you're specifying a value of 0. It's easier to read and there's no guesswork (for both the browser and someone else who may be reading your CSS).

EDIT: Pulled this from a forum. They are the CSS properties that accept integer values for CSS 2.1 specifications:

  • z-index
  • font-weight
  • line-height
  • counter-reset
  • counter-increment
  • volume
  • stress
  • pitch-range
  • richness
Cory Larson
but many css typography best practices prefer line-height unit-less like here for example http://21picas.co.uk/?p=364
metal-gear-solid
@Jitendra - `line-height: 1.5` means 1.5 times the font-size; it's a special unit for line-height, different in meaning from 150%, but similar to `1.5em`
K Prime
A: 

Every numerical value other than 0 should have a unit.

margin:0; //Good
margin:15; //Bad.  Do you want px, em, %, etc?
Tyler Smith
A: 

I am pretty sure I have had instances where leaving the value type off lead to display problems in other browsers. This is because they default to different types.
0 is 0 in any type.
Where 5px (pixels) can be a lot different then 5em (Width of the Current Fonts capital letter M).
As a best practice I say always use them. It's only a few more bytes of bandwidth.

Simon Omega