Current location: Hot Scripts Forums » General Web Coding » CSS » Which is better? EMs or PIXELs?


Which is better? EMs or PIXELs?

Reply
  #1 (permalink)  
Old 01-02-07, 05:39 PM
undyboy91's Avatar
undyboy91 undyboy91 is offline
Newbie Coder
 
Join Date: Jan 2007
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Which is better? EMs or PIXELs?

I recently bought the video from lynda.com for CSS Design and the instructor said that ems are the way to go. I personally really don't feel comfortable with ems knowing that a change in the font size would drastically change the outcome of my intended layout. Which unit do you guys prefer?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 01-02-07, 10:04 PM
wirehopper's Avatar
wirehopper wirehopper is offline
-
 
Join Date: Feb 2006
Posts: 2,516
Thanks: 20
Thanked 109 Times in 106 Posts
ems are good because you can scale them to the size of the other text.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 01-02-07, 10:27 PM
jfulton's Avatar
jfulton jfulton is offline
Community VIP
 
Join Date: Apr 2006
Location: Los Angeles, CA
Posts: 660
Thanks: 0
Thanked 0 Times in 0 Posts
It really depends on what kind of layout you want. I do try to stay away from all px though. But you sometimes you need to use them, especially if your layout has lots of images/background images. Sometimes you need the precision, and sometimes you don't want your containers to expand with the text. It's really a matter of taste and the situation...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 01-10-07, 01:27 AM
Alan+61415484049 Alan+61415484049 is offline
Newbie Coder
 
Join Date: Dec 2006
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Use EM's to style DIV's 18.939583 kilometers high!

Go with percents until you've drilled down to pixel level with your layout.
Then Go LARGE with this little css gem:-

Code:
/* highest element of the world: */
div#ems18939 { 
font-size: 100cm; 
height: 18939em; 
line-height: 1.0
}
This creats a HUGE div, impossible to scroll...

Quote:
Gecko-based browsers like Firefox show an interesting behavior when a DIV is styled any higher than precisely 18,939 EM'S by “shrinking” or “collapsing” the container. Internet Explorer doesn’t accept internal references behind the real action, and it’s unclear if the container height really is 18.939 kilometers - about 11.769 miles.
http://worlds-highest-website.com/#hades
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #5 (permalink)  
Old 01-11-07, 08:20 AM
pkcidstudio's Avatar
pkcidstudio pkcidstudio is offline
Coding Addict
 
Join Date: Nov 2005
Posts: 332
Thanks: 0
Thanked 0 Times in 0 Posts
There are two types of length units: relative and absolute. Relative length units specify a length relative to another length property. Style sheets that use relative units will more easily scale from one medium to another (e.g., from a computer display to a laser printer). - W3C Relative units are:
  • em: the 'font-size' of the relevant font
  • ex: the 'x-height' of the relevant font
  • px: pixels, relative to the viewing device
The .em unit can be troublesome, though theoretically it is ideal. Read the following from the W3C specs and note the potential pitfalls: The 'em' unit is equal to the computed value of the 'font-size' property of the element on which it is used. The exception is when 'em' occurs in the value of the 'font-size' property itself, in which case it refers to the font size of the parent element. It may be used for vertical or horizontal measurement. (This unit is also sometimes called the quad-width in typographic texts.)
__________________
learning like everyone else
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #6 (permalink)  
Old 01-15-07, 09:12 PM
hen3rz's Avatar
hen3rz hen3rz is offline
Newbie Coder
 
Join Date: Jun 2005
Location: Australia
Posts: 96
Thanks: 0
Thanked 0 Times in 0 Posts
I always work in pixels, its much easier to align images and backgrounds against them. Its also good cause you know exactly how it will look. Working with percentages means you cant be certain how it will appear in different sized browser windows.
__________________
Foinq.com - Free Unlimited Web Hosting
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #7 (permalink)  
Old 01-16-07, 02:00 AM
Vicious's Avatar
Vicious Vicious is offline
Community VIP
 
Join Date: Jan 2007
Location: Belgium
Posts: 584
Thanks: 0
Thanked 0 Times in 0 Posts
It's true that pixels are easier to align, or even measure in general. But for text, I think, it's better to use em's. My boss has a bad vision, so every time I demonstrate him something, he wants to put the text size bigger. If your text has a fixed pixel-height, he can't do that.

That's why I always end up with putting the text in em's, and avoiding fixed height elements (divs). Once max-height & max-width are fully supported in IE, you can make sure your layout still looks good, while using em's.
__________________
Jack Bauer makes Chuck Norris cry
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
slider location? beeble JavaScript 0 11-18-06 12:42 AM
Pay for pixels! Effective advertising! thepixelbuzz Traffic Exchange 12 01-26-06 06:48 AM
Pixels pixelpixy Website Reviews 1 09-30-05 07:17 AM


All times are GMT -5. The time now is 09:58 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.