A quick question

K

Kate

I was just wondering which is better to use in my css px, pt or em?

Many thanks in advance,
Kate
 
B

Beauregard T. Shagnasty

Kate said:
I was just wondering which is better to use in my css px, pt or em?

Percentages.

body { font-size: 100%; }
h1 { font-size: 140%; }
h2 { font-size: 130%; }
td { font-size: 100%; }
..legalese, .copyright { font-size: 90%; }
and so on...

Using em causes problems with Internet Explorer. Using px or pt means
that IE users cannot resize your text should the person have vision
problems and need larger text.
 
B

Barbara de Zoete

I was just wondering which is better to use in my css px, pt or em?

Those are units to define a length value for a proporty for a selector in
CSS. Fully depends on what selector (perhaps combined with what property).

For example, I use:

em for sizes of boxes;
px for sizes of borders (mostly) --> Always a bad idea for font size
(Google for tons of posts with the reasons);
pt --> never (I see no point ;-) . pt is nice on paper, not in screen
media IMO);
% just when it seems appropriate if selector needs to have a dimention
that is % of parent.

See? So what length are you needing? What selector? What property?

--
,-- --<--@ -- PretLetters: 'woest wyf', met vele interesses: ----------.
| weblog | http://home.wanadoo.nl/b.de.zoete/_private/weblog.html |
| webontwerp | http://home.wanadoo.nl/b.de.zoete/html/webontwerp.html |
|zweefvliegen | http://home.wanadoo.nl/b.de.zoete/html/vliegen.html |
`-------------------------------------------------- --<--@ ------------'
 
K

Kate

Barbara de Zoete said:
Those are units to define a length value for a proporty for a selector in
CSS. Fully depends on what selector (perhaps combined with what property).

For example, I use:

em for sizes of boxes;
px for sizes of borders (mostly) --> Always a bad idea for font size
(Google for tons of posts with the reasons);
pt --> never (I see no point ;-) . pt is nice on paper, not in screen
media IMO);
% just when it seems appropriate if selector needs to have a dimention
that is % of parent.

See? So what length are you needing? What selector? What property?

:) Everything that both yourself and Beauregard mentioned. I was unsure
as to which I should use for which.

i.e.:
Text, Position, Widths, Borders you get the idea. I have read so many
conflicting p.o.v. That I became more confused than when I first started
looking into it.

Kate
 
B

Barbara de Zoete

:) Everything that both yourself and Beauregard mentioned. I was
unsure as to which I should use for which.

i.e.:
Text, Position, Widths, Borders you get the idea. I have read so many
conflicting p.o.v. That I became more confused than when I first started
looking into it.

I see. Well, all starts with the design concept. If you go for fluid or
liquid (see <http://www.google.com/search?q=liquid+design>), you will love
proportional units for just about everything. If you use proportional
units (like em and %), your pages' design will adapt to any screensize and
zoom ration by adjusting all parts relatively to eachother.
If you need something to be fixed, go with px. But please do not use them
for font size, for reasons Beauregard mentioned.

Was this of any help at all?


--
,-- --<--@ -- PretLetters: 'woest wyf', met vele interesses: ----------.
| weblog | http://home.wanadoo.nl/b.de.zoete/_private/weblog.html |
| webontwerp | http://home.wanadoo.nl/b.de.zoete/html/webontwerp.html |
|zweefvliegen | http://home.wanadoo.nl/b.de.zoete/html/vliegen.html |
`-------------------------------------------------- --<--@ ------------'
 
K

Kate

Barbara de Zoete said:
I see. Well, all starts with the design concept. If you go for fluid or
liquid (see <http://www.google.com/search?q=liquid+design>), you will love
proportional units for just about everything. If you use proportional
units (like em and %), your pages' design will adapt to any screensize and
zoom ration by adjusting all parts relatively to eachother.
If you need something to be fixed, go with px. But please do not use them
for font size, for reasons Beauregard mentioned.

Was this of any help at all?

Yes it's a great help. Many.... many thanks Barbara and Beauregard. Like
they say the internet is very useful tool, if you know where to look. But
it can also be unhelpful when you get a list of 200 sites, and then you need
to figure out who actually knows what they are talking about.

Have a great week,
Best regards Kate.
 
S

Steve Pugh

Kate said:
I was just wondering which is better to use in my css px, pt or em?

Use them for what?

px are great for things that are intrinsically sized in pixels -
images for example. They're also useful for things like borders (only
the most hard core flexible design purist would insist on using em or
% for borders - though with some layouts using % is a boon as you can
then add everyhing up)

pt are great, in theory, for print stylesheets but unless you know the
paper size, etc. to be used print is actually only slightly more
restricted than screen. pt and the other physical units (pica, in, cm,
mm) are best used when you know the exact characteristics of the
output medium - e.g. a kiosk display.

em are useful for things that are best made flexble based on the font
size, so many paddings and margins are best specified in em.

You didn't mention % which is possibly the most useful length unit.

Steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,563
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top