By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,677 Members | 1,798 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,677 IT Pros & Developers. It's quick & easy.

Alias names for css classes?

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: n/a
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

P: n/a

"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.