+ 2
How is using "em" better dan "px"?? What is exactly "em"?
12 Antworten
+ 5
em is a relative size unit and px is an absolute unit.
When you set the font size using px it often stops the user from changing the size of the font using their browser. This means it should look the same on all browsers but is bad if the person viewing your webpage has sight difficulties as they may not be able to read it.
Using em allows the user to set the size of the font so em=1 is the default size of font and for most people is the same as px=16 but if you change the default in your browser because you need it to be zoomed the text will be bigger. This is usually better as then everybody can read it.
+ 20
@rohan It's not my fault BTW.
You should have written units in your question...
Typo ;)
+ 18
Ok fine, gotcha!
+ 9
@dayve actually rohan is not talking about <em>tag but he is talking measurement units
+ 8
Actually while using em to provide dimensions, elements gets resized with the window resizing afaik.
You can go through below link for better understanding:
http://kyleschaeffer.com/development/css-font-size-em-vs-px-vs-pt-vs/
+ 7
@rohan i also want to know please someone answer
+ 4
em is better for everybody so use that (unless you have a really good reason that you need a font in exactly the same size on every bodies screen...like a message in a game that has to always fit in a specific sized box)
+ 1
Use em or % whenever you can.
0
thank u for ur answer sir..but i asked bout d em unit...not the tag
0
@Dayve yup sory..i forgot about d tag..so i didnt mentioned "unit"..
0
so what sud i use?? em or px?
0
@shane thanks