2 replies [Last post]
Roberta
Roberta's picture
User offline. Last seen 1 year 50 weeks ago. Offline
newbie
Timezone: GMT-5
Joined: 2010-02-06
Posts: 5
Points: 7

Puzzled

I have some code that looks fine online. But I'm thinking there has to be a better way to do this that I don't know about:

p.first {font-family: Arial, Helvetica; font-size: 120%; color:#6E0000; font-style: italic; font-weight: bold; text-indent:50px;}
p.second {font-family: Arial, Helvetica; font-size: 150%; color:#6E0000; font-weight: bold; text-indent:50px;}
p.third {font-family: Arial, Helvetica; color:#6E0000; font-size:120%; font-weight:bold; min-width:35em; max-width:60em; text-indent:22px;}
p.fourth {font-family: Arial, Helvetica; font-size: 100%; font-weight: bold; text-indent:20px; padding-right:2cm;}
p.fifth {font-style: italic; font-family: Arial, Helvetica; font-size: 100%; font-weight: bold;}

So many of the elements are the same.

Am I correct, or does it have to be this way?

Thanks!!

Tyssen
Tyssen's picture
User offline. Last seen 1 day 11 hours ago. Offline
rank Moderator
Moderator
Timezone: GMT+10
Joined: 2004-05-01
Posts: 8123
Points: 1302

You should set a base font

You should set a base font style on the body tag and then only adjust it where it needs to be different from the default. So you'd end up with something like:

body {font: bold 100% Arial, Helvetica; color:#6E0000; }
p.first {font-size: 120%; font-style: italic; text-indent:50px;}
p.second {font-size: 150%;  text-indent:50px;} 
p.third {font-size:120%; min-width:35em; max-width:60em; text-indent:22px;} 
p.fourth {text-indent:20px; padding-right:2cm;}
p.fifth {font-style: italic }

How to get help
Post a link. If you can't post a link, jsFiddle it.
My blog | My older articles | CSS Reference

Roberta
Roberta's picture
User offline. Last seen 1 year 50 weeks ago. Offline
newbie
Timezone: GMT-5
Joined: 2010-02-06
Posts: 5
Points: 7

Ahh. I knew it was something

Ahh. I knew it was something simple like that.

Thanks, Tyssen!!