Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

CSS Forum


You are currently viewing our CSS Forum as a guest. Please register to participate.
Login



Reply
I want to convert em to px
Old 06-19-2007, 02:55 AM I want to convert em to px
soumen_07's Avatar
Average Talker

Posts: 29
Name: Soumen paul
Trades: 0
hello,

i want to convert 1 em to px. how to do this?

SPaul
soumen_07 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 06-19-2007, 04:55 AM Re: I want to convert em to px
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
px and pt, amongst others, are absolute values.
em is a relative value (I think).

I'd recommand you to keep to use em for your fonts size.
A font size set in px is not following your users preferences for the font size.
But when they are set via em, they do follow the users preferences.

If you still want to convert them, look at these links, but take in count that the conversion is not linear.
an px to em conversion will produce different values for different fonts:
http://archivist.incutio.com/viewlist/css-discuss/78195
http://riddle.pl/emcalc/
http://www.jerekdain.com/fontconversion.html
__________________
Only a biker knows why a dog sticks his head out the window.
tripy is offline
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Old 06-19-2007, 04:56 AM Re: I want to convert em to px
Ultra Talker

Posts: 256
Location: Auckland, New Zealand
Trades: 0
First of all, why? It sounds like you're going backwards than forwards.

Anyways, to simply answer it, em is not a fixed measurement, it's based on what size you give it and it relates to that, there's no conversion for anything until you know what fixed measurement you're using it to base it off. In other words it's like saying how do I make % into px, when a % needs a fixed number before it's of any use.

Browsers usually have a default font size, which I believe is 16px, so 1em should be 16px, however each parent/child elements can have their own sizes, which changes the way em works again because it works by inheriting the font size that's used for those elements.

Hopefully this helps, but you should find another way to do what you're wanting without fixing the size.

Cheers,

MC
__________________
#------------------------------signature---------------------------------------------------------------------------------#
Quote:
I am well recognised for what I don't do than what I do. Chores are just one of those things.
mastercomputers is offline
Reply With Quote
View Public Profile Visit mastercomputers's homepage!
 
Old 06-19-2007, 02:48 PM Re: I want to convert em to px
LadynRed's Avatar
Defies a Status

Posts: 10,017
Location: Tennessee
Trades: 0
I usually set the base font size in the rules for <body>, and I set it to 100.1% (to make up for rounding problems). Everything else is set to ems or percentages based off of that 100.1% - or basically 16px.
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

LadynRed is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to I want to convert em to px
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 1.11573 seconds with 12 queries