|
-
Mar 23rd, 2011, 12:51 PM
#1
px or em in your css?
What do you all use for sizing - font and borders and such?
-
Mar 23rd, 2011, 01:00 PM
#2
Re: px or em in your css?
We have a web designer for us now, so I haven't done CSS in ages, but I typically used em for fonts and pixels for everything else.
-
Mar 23rd, 2011, 02:24 PM
#3
Re: px or em in your css?
Usually it's a consideration of what is layout (and what kind of layout) vs content. If I haven't made a "liquid" layout (one that will self-adjust to text size changes), then I don't want a site to look broken because someone upped their font size. So in that case, layout elements will likely be pixels.
For content font, I use a variation of what is discussed in this article: use a percentage as the initial size value, and then ems for the rest.
-
Mar 23rd, 2011, 06:08 PM
#4
Re: px or em in your css?
I use ems and px for padding, px for margins, px for borders, px for widths and heights, and neither for font sizing (I use xx-small, x-small, small, medium, large, x-large, and xx-large )
-
Mar 23rd, 2011, 07:12 PM
#5
Re: px or em in your css?
em, because px is derived from em. The only reason to use px is when doing absolute positioning (e.g. floating elements with JS).
This is less of a problem with modern browsers because they all tend to scale elements now rather than simply increase text size.
-
Mar 31st, 2011, 03:05 AM
#6
Re: px or em in your css?
I use px each time the size of the element must be related to a background image. This avoids having a broken layout. Things may change with multiple background images, haven't played around with them a whole lot yet.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|