Jump to content

Archived

This topic is now archived and is closed to further replies.

spyke01

ems vs pxs

Recommended Posts

i am redesigning my current site with more css and JS, and wanted to see what the big difference is between ems and pxs. is there a way to make  1em=1px? the reason i ask is because i like the control i have with pxs, if i cant make them the same, or its not a good idea, then can someone help me with this:

Ok we have this box:
+----+----------+
|      |              |
|      |              |
|      |              |
+----+----------+

It is 900px wide, the left column is 200px and the right 700px, we want 2px padding all the way around, so our css is like this:
[code]
#box {
    width: 900px;
    padding: 0px;
    margin: 0px;
}

#left-col {
    width: 196px;
    padding: 2px;
}

#right-col {
    width: 696px;
    padding: 2px;
}
[/code]

how does this relate in terms to ems if our default text is this:
[code]
body {
font-family: Helvetica, Tahoma, Verdana, Arial, sans-serif;
font-size: 12px;
}
[/code]

Share this post


Link to post
Share on other sites
http://www.clagnut.com/blog/348/ explains in considerable detail as well as addressing your (type) of problem.  One em is the width of the letter M (hence the name).

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.