467,110 Members | 1,339 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,110 developers. It's quick & easy.

Alias names for css classes?

Lets say you've created a css style called .ninetypercent that sets
the font size to 90%. Then lets say you want that style to be applies
to certain types of textual content (e.g., help text and cross
references). Is there a way to have .helptext and .crossreference
styles act as aliases of .ninetypercent or do you have to create three
iterations of the same style in the css?

Thanks for any advice.
Jul 20 '05 #1
  • viewed: 19218
Share:
3 Replies
Monty wrote:
Lets say you've created a css style called .ninetypercent that sets
the font size to 90%.
Not very user-friendly if it's used for large amounts of text.
you want that style to be applies to certain types of textual content
(e.g., help text and cross references). Is there a way to have
.helptext and .crossreference styles act as aliases of .ninetypercent
No, but you can assign more than 1 class to an element.

<DIV CLASS="ninetypercent helptext">
do you have to create three iterations of the same style in the css?


You could do that, or apply the styles in 1 block.

..ninetypercent, .helptext, .crossreference {
font-size: 100%; /* etc */
}

--
Brian (remove "invalid" from my address to email me)
http://www.tsmchughs.com/
Jul 20 '05 #2
Monty wrote:
Lets say you've created a css style called .ninetypercent that sets
the font size to 90%.
That's your first mistake. Don't give classes names that describe their
appearance. If you later decide to go to 85%, you need to either put up
with a nonsensical name or a multi-file search-and-replace.
Then lets say you want that style to be applies
to certain types of textual content (e.g., help text and cross
references). Is there a way to have .helptext and .crossreference
styles act as aliases of .ninetypercent or do you have to create three
iterations of the same style in the css?


Don't create .ninetypercent. Do this:

..helptext, .crossreference { font-size: 90%; }

--
Mark.
Jul 20 '05 #3

"Mark Tranchant" <ma**@tranchant.plus.com> wrote in message
news:X6*******************@wards.force9.net...
Monty wrote:
Lets say you've created a css style called .ninetypercent that sets
the font size to 90%.


That's your first mistake. Don't give classes names that describe their
appearance. If you later decide to go to 85%, you need to either put up
with a nonsensical name or a multi-file search-and-replace.


....which, to say it explicitly, completely defeats the purpose of using CSS
for presentation.
Jul 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Bill Kratzer | last post: by
5 posts views Thread by Santiago Ordax Solivellas | last post: by
10 posts views Thread by Kimmo Laine | last post: by
5 posts views Thread by Jon Shemitz | last post: by
56 posts views Thread by Peter Olcott | last post: by
21 posts views Thread by Peter Olcott | last post: by
4 posts views Thread by WT | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.