dushyant.agarwal Posted May 18, 2010 Share Posted May 18, 2010 Hi,I would like to get opinion on which approach among Pixels(pix or px), Point(pt) or Percentage(%) is the best practice, while giving widths and heights in .html files or CSS.Thanks. Link to comment Share on other sites More sharing options...
chibineku Posted May 18, 2010 Share Posted May 18, 2010 They all have a place (as do ems), and it depends what you want to do. If you want your content to be a certain proportion of the page, you use %, whereas if you want a fixed width layout, you'd use px. I don't think there are any hard and fast rules - you just use whatever gives you the effect/accuracy you want. Link to comment Share on other sites More sharing options...
ShadowMage Posted May 18, 2010 Share Posted May 18, 2010 Depends on what effect you want to achieve. When you use pixels you set a static dimension. That width/height will never change regardless of browser window size or screen resolution. If you use percents or ems, you'll get a 'fluid' effect. Which means that the elements dimensions will change depending on the window size and screen resolution. The em measure is relative to font size, though I'm not 100% sure what the relationship is. Link to comment Share on other sites More sharing options...
thescientist Posted May 18, 2010 Share Posted May 18, 2010 It is representative of the the letter 'm' I believe, maybe since it is the widest letter? Anyway, its relative to the current font size and acts as a multiplier, of sorts.http://www.w3schools.com/css/css_units.asp Link to comment Share on other sites More sharing options...
boen_robot Posted May 18, 2010 Share Posted May 18, 2010 ... current size (in general), not just for fonts I think. 1em is the size that would be if you don't specify anything. 2em is two times that size. I mean just try to use ems on a box... it should work. Link to comment Share on other sites More sharing options...
Guest Evanion Posted June 7, 2010 Share Posted June 7, 2010 Best practice would be (in my meaning), to specify font:100% in body, and then use ems (at 100% 1em=16px) for text and minor layout stuff. and px/% for layout where applicable.There is no ONE best unit, if there was ... the rest would get deprecated. But as a rule of thumb, 'reset' the font size to 100% in body, and then use ems to set the final size. Ems are more compatible with support systems for people with bad eyesight and was introduced as a mix between px and % (or so I have heard). Link to comment Share on other sites More sharing options...
Ingolme Posted June 8, 2010 Share Posted June 8, 2010 Best practice would be (in my meaning), to specify font:100% in body, and then use ems (at 100% 1em=16px) for text and minor layout stuff. and px/% for layout where applicable.There is no ONE best unit, if there was ... the rest would get deprecated. But as a rule of thumb, 'reset' the font size to 100% in body, and then use ems to set the final size. Ems are more compatible with support systems for people with bad eyesight and was introduced as a mix between px and % (or so I have heard).I reset the font to 62.5% in the body so that 1em is 10 pixels. Link to comment Share on other sites More sharing options...
music_lp90 Posted June 10, 2010 Share Posted June 10, 2010 I reset the font to 62.5% in the body so that 1em is 10 pixels.Thanks, Inglome. I think I will start doing that. Link to comment Share on other sites More sharing options...
Fmdpa Posted June 11, 2010 Share Posted June 11, 2010 Is "pix" valid? Link to comment Share on other sites More sharing options...
Synook Posted June 11, 2010 Share Posted June 11, 2010 No (however, some user agents may default to pixels if an unrecognised unit is specified). Link to comment Share on other sites More sharing options...
ballack999 Posted June 17, 2010 Share Posted June 17, 2010 px 's useful for showing on monitor.pt 's useful for printing.px 's not influential in printing it's only for monitor Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.