2

I like to use em, and tend to stay away from % because it tends to screw up the design easily, and pt, px, cm... Because they aren't that friendly to all devices. Am I right in doing so?

TylerH
  • 20,799
  • 66
  • 75
  • 101
DarkLightA
  • 14,980
  • 18
  • 49
  • 57

3 Answers3

3

There are reasons why css offers you a choice. So it isn't really a question of right or wrong. But if you are looking for a way to make your site more accessible by making fonts and elements scale easier, then you are on the right path. Go with em.

weltraumpirat
  • 22,544
  • 5
  • 40
  • 54
2

It depends. Using em links dimensions to the font size and using % links to the size of the container (and ultimately the screen). In some places one will be better than the other for achieving a consistent effect. I agree it is generally good to avoid absolute units, but px is useful for small dimensions (e.g. border widths, shims).

OrangeDog
  • 36,653
  • 12
  • 122
  • 207
  • One thing that continues to bug me about px/em is margin setting. So often I want fixed width margins but the rest of my layout will be fluid :/ – danjah Dec 20 '10 at 12:19
  • 1
    @Danjah - There's nothing inherently wrong with px dimensions, just don't use them for things like column widths or text containers. – OrangeDog Dec 20 '10 at 12:22
  • 49% column a, 49% column b, leaves 2% - but I want L/R margins at 10px not 1%, so I am left with a gap somewhere... – danjah Dec 20 '10 at 12:27
  • 1
    @Danjah - Don't over-constrain the widths then. Define the margins and allow the columns to expand to fill the space. – OrangeDog Dec 20 '10 at 12:29
  • The thing is that I prefer having a design like the one on this very page, rather than any set percentage. With this design, if you want to focus on the right-hand menu, you can. – DarkLightA Dec 20 '10 at 12:46
  • @DarkLightA - AFAICT this website has exact pixel widths for the main column (735px) and the sidebar (220px). – OrangeDog Dec 20 '10 at 14:02
1

Yes. It scales, its easy to remember, and even easy to convert into other measurements for comparison :)

danjah
  • 2,939
  • 2
  • 30
  • 47