|
|
|
|
Thread title: Use of the 'em' unit? |
|
|
|
|
|
Thread tools
Search this thread
Display Modes
|
|
09-04-2005, 05:02 PM
|
#1
|
Status: Member
Join date: Jun 2005
Location:
Expertise:
Software:
Posts: 460
|
Use of the 'em' unit?
Hey, can anyone tell me how the 'em' unit works in HTML/CSS?
For example:
Code:
img {
margin: 0;
padding: 0.4 em;
}
Thanks.
|
|
09-05-2005, 02:29 AM
|
#2
|
Status: Member
Join date: Mar 2005
Location:
Expertise:
Software:
Posts: 473
|
an 'em' the length of a capital M, it is used so there is a spacing unit relevant to the text size.
So in this case, the padding of the image will be 0.4 % of the width of the letter M in whatever text size has been set.
|
|
09-05-2005, 04:09 AM
|
#3
|
Status: I love this place
Join date: Jul 2004
Location: Montreal
Expertise:
Software:
Posts: 540
|
In other words, don't use it for layout if you want a static design. And when the text size is at normal, I think it's 16px or around that, just to get an idea.
|
|
09-05-2005, 04:45 AM
|
#4
|
Status: design rockstar
Join date: Jan 2005
Location: guelph, ontario
Expertise:
Software:
Posts: 2,246
|
or resize the text size, so 1em is a useable size.
|
|
09-05-2005, 10:02 AM
|
#5
|
Status: Community Archaeologist
Join date: Jul 2004
Location: Scotland
Expertise: Software Development
Software: vim, PHP
Posts: 3,820
|
Originally Posted by Cheyne
... the padding of the image will be 0.4 % of the width of the letter M ...
|
In this case, it's actually 40% (0.4). Just to avoid any confusion.
|
|
09-05-2005, 01:02 PM
|
#6
|
Status: Member
Join date: Jun 2005
Location:
Expertise:
Software:
Posts: 460
|
|
|
09-06-2005, 07:13 AM
|
#7
|
Status: Simply to simplify
Join date: Apr 2005
Location: Foxton, Manawatu, New Zealand
Expertise:
Software:
Posts: 5,572
|
dumbcoder, make sure you don't have a space between 0.4 and em like you have above, it should always have no gap between the two.
|
|
09-07-2005, 01:14 PM
|
#8
|
Status: Junior Member
Join date: Jun 2005
Location: Kansas
Expertise:
Software:
Posts: 44
|
Personally, I think it best to use points or pixels rather than ems.
|
|
09-07-2005, 03:13 PM
|
#9
|
Status: Narassist
Join date: May 2005
Location: USA
Expertise:
Software:
Posts: 4,469
|
pixels is more exact when working with small changes
|
|
09-08-2005, 07:50 AM
|
#10
|
Status: Simply to simplify
Join date: Apr 2005
Location: Foxton, Manawatu, New Zealand
Expertise:
Software:
Posts: 5,572
|
moped and bennett, pixels and points are too restrictive when you are designing for accessibility. Em gives the text fluidity, which people with poor eyesight need, so they enlarge the text.
|
|
|
|
|
|
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
|