what is the difference px,em and ex? Amd when you define font-size in css, do i use px,pt or em?
+1
A:
what is the difference px,em and ex?
http://www.w3.org/TR/CSS21/syndata.html#length-units describes those and the other length units available in CSS
Amd when you define font-size in css, do i use px,pt or em?
As a rule of thumb, use percentages on screen and pt for print.
David Dorward
2010-03-05 10:01:59
+2
A:
http://www.w3schools.com/css/css_units.asp
em depends on the user's browser size
px is absolute
one ex is the x-height of a font (x-height is usually about half the font-size)
Please search a little bit before asking here.
remi bourgarel
2010-03-05 10:03:11
+1 for recommending search.
macek
2010-03-05 10:04:49
@remi:i actually did some search on the web,found a lot of definitions...i just wanted to get some wisdom from people who has had real life experiences in using them in their projects,...thanks 4 ur comments
manraj82
2010-03-05 10:19:58
w3c is your BFF. In W3c We trust.
remi bourgarel
2010-03-05 10:44:43
w3s is not w3c; in w3s we complain about huge amounts of advertising (mostly for themselves) and errors.
David Dorward
2010-03-05 11:02:53
A:
- pm are pixels.
- em is based on the width of the 'm' letter on the current font
- ex is based on the height of the 'x' letter on the current font.
Have a look here : read at section 3.4.2
See also wikipedia
David V.
2010-03-05 10:03:39
em is not based on the width of an 'm'. A typographic em is the width of an **M**, and a CSS em is the font-size.
David Dorward
2010-03-05 10:05:29
Mixed typography and CSS. I stand corrected. edit: That being said, a search reveals that many sites fall for the same mistake.
David V.
2010-03-05 10:08:37
David V., the wikipedia article you linked to is titled, *Em (typography)*. So yes, you are wrong. CSS `em` is equivalent to element `font-size`.
macek
2010-03-05 10:09:18
I linked the wikipedia article to provide further information. I admit that was confusing.
David V.
2010-03-05 10:15:05
A:
**em**: the 'font-size' of the relevant font
**ex**: the 'x-height' of the relevant font
**px**: pixels, relative to the viewing device
You can get the details on following Link: difference px,em and ex
Shivkant
2010-03-05 10:04:28
+1
A:
- Pixels are browser dependent. It is the absolute size that you would see on your screen.
- Em are sort of like percentages.Ems is referring to the base text size. The value of 1 em means the same thing as a value of 100 percent. But you can also say it the opposite way: A percentage valueis just an em multiplied by 100.
- Points(pt) are what you would want to use on print media.
jpartogi
2010-03-05 10:11:38