Alias names for css classes?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Monty

    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.
  • Brian

    #2
    Re: Alias names for css classes?

    Monty wrote:[color=blue]
    > Lets say you've created a css style called .ninetypercent that sets
    > the font size to 90%.[/color]

    Not very user-friendly if it's used for large amounts of text.
    [color=blue]
    > 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[/color]

    No, but you can assign more than 1 class to an element.

    <DIV CLASS="ninetype rcent helptext">
    [color=blue]
    > do you have to create three iterations of the same style in the css?[/color]

    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)

    Comment

    • Mark Tranchant

      #3
      Re: Alias names for css classes?

      Monty wrote:
      [color=blue]
      > Lets say you've created a css style called .ninetypercent that sets
      > the font size to 90%.[/color]

      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.
      [color=blue]
      > 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?[/color]

      Don't create .ninetypercent. Do this:

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

      --
      Mark.

      Comment

      • Harlan Messinger

        #4
        Re: Alias names for css classes?


        "Mark Tranchant" <mark@tranchant .plus.com> wrote in message
        news:X6Jqc.4871 $wI4.580686@war ds.force9.net.. .[color=blue]
        > Monty wrote:
        >[color=green]
        > > Lets say you've created a css style called .ninetypercent that sets
        > > the font size to 90%.[/color]
        >
        > 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.[/color]

        ....which, to say it explicitly, completely defeats the purpose of using CSS
        for presentation.


        Comment

        Working...