HighDots Forums  

Padding / margins. PX or EM?

alt.html alt.html


Discuss Padding / margins. PX or EM? in the alt.html forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Mike Barnard
 
Posts: n/a

Default Padding / margins. PX or EM? - 03-20-2008 , 07:04 AM






As heading. When using paddings I find myself using very small
figures, 3px and so on. I could use 0.2em or similar, but is it worth
it? Do you pad with px or em?

Thinks... padding with em means the padding gets bigger as the text
does, meaning less space for the now bigger text to fit in to. I
think it must remain at PX.

I've typed this now, so I'll post it anyway. Comments?

Mike.

Reply With Quote
  #2  
Old   
Bergamot
 
Posts: n/a

Default Re: Padding / margins. PX or EM? - 03-20-2008 , 08:26 AM






Mike Barnard wrote:
Quote:
As heading. When using paddings I find myself using very small
figures, 3px and so on. I could use 0.2em or similar, but is it worth
it? Do you pad with px or em?
I use px, em or %, depending on the context.

% is a good choice if you want widths to scale to the window size.
Larger windows will have more, smaller windows less.

Quote:
Thinks... padding with em means the padding gets bigger as the text
does, meaning less space for the now bigger text to fit in to.
Agreed. I use a fairly large default text, combined with a usually
~800px wide window. When margins and/or padding are set in ems, it does
leave less space for actual content. Sometimes a lot less.

Quote:
I
think it must remain at PX.
For padding, especially, you want enough to keep the content readable,
but it doesn't really have to scale with text size.

I suggest px or %.

--
Berg


Reply With Quote
  #3  
Old   
Bergamot
 
Posts: n/a

Default Re: Padding / margins. PX or EM? - 03-20-2008 , 08:37 AM



Beauregard T. Shagnasty wrote:
Quote:
If padding is in em units, it will
expand with text resizing. If in px units, it will not change, and the
text will spill out of the box.
Not everything needs to scale to the user's text size. Margins and
padding especially.

A 20px left/right padding would keep a good amount of white space
between the block edge and text. This is independent of content width,
and there is no reason why it needs to change with the visitor's text size.

Quote:
Generally, use px only for borders, and image sizing. Use em for
everything else.
I disagree. % can be a better choice than em in a lot of cases.

--
Berg


Reply With Quote
  #4  
Old   
C A Upsdell
 
Posts: n/a

Default Re: Padding / margins. PX or EM? - 03-20-2008 , 09:12 AM



Mike Barnard wrote:
Quote:
As heading. When using paddings I find myself using very small
figures, 3px and so on. I could use 0.2em or similar, but is it worth
it? Do you pad with px or em?

Thinks... padding with em means the padding gets bigger as the text
does, meaning less space for the now bigger text to fit in to. I
think it must remain at PX.
One thing to consider is that I have observed that using fractions of em
or ex units can result in inconsistencies. E.g., if I specify a border
that is 0.15ex thick, the actual thickness in pixels may vary depending
on which side of the box the browser draws the border. For large
fractions of em or ex units, this hardly matters, but for small
fractions it can look very odd.


Reply With Quote
  #5  
Old   
Ben C
 
Posts: n/a

Default Re: Padding / margins. PX or EM? - 03-20-2008 , 04:43 PM



On 2008-03-20, Beauregard T. Shagnasty <a.nony.mous (AT) example (DOT) invalid> wrote:
Quote:
Mike Barnard wrote:

As heading. When using paddings I find myself using very small
figures, 3px and so on. I could use 0.2em or similar, but is it
worth it? Do you pad with px or em?

Thinks... padding with em means the padding gets bigger as the text
does, meaning less space for the now bigger text to fit in to. I
think it must remain at PX.

Methinks you have it backwards there. If padding is in em units, it will
expand with text resizing. If in px units, it will not change, and the
text will spill out of the box.
The text won't spill out unless you set the width or height in px.
You'll just get a constant thickness padding around it.


Reply With Quote
  #6  
Old   
Mike Barnard
 
Posts: n/a

Default Re: Padding / margins. PX or EM? - 03-20-2008 , 04:54 PM



On Thu, 20 Mar 2008 11:04:25 +0000, Mike Barnard
<m.barnard.trousers (AT) thunderin (DOT) co.uk> wrote:

Quote:
As heading. When using paddings I find myself using very small
figures, 3px and so on. I could use 0.2em or similar, but is it worth
it? Do you pad with px or em?

Thinks... padding with em means the padding gets bigger as the text
does, meaning less space for the now bigger text to fit in to. I
think it must remain at PX.

I've typed this now, so I'll post it anyway. Comments?

Mike.
My wrist aches. Too long at the keyboard!

Thanks to you all. Sometimes I forget I have percentages as another
option. In trying to get nicely fluid left and right columns I was
using em at one point and when the text was increased (quite a long
way) the center content was a vertical column of characters with a big
white space next to it.

Oh well. Thanks again.


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.