Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

create a function in css?

is it possible to create a function in css that can call multiple classes?

i am trying to call multiple classes at one time, i know i can use it in html element by calling each of its class' name. but i have 8 classes to call and i have to key all of it whenever it is needed

simply put:

im creating a css curved box using .png images and i want a function to control it. if not possible is there any other way that can be used (i have 4 corners, top, bottom, left & right images)?

please help.

Update:

i have tried the class="class1 class2 class3" but only the class1 is displayed.

2 Answers

Relevance
  • ?
    Lv 5
    1 decade ago
    Favorite Answer

    No, there are no functions in css.

    There are two solutions that I can think of:

    Minimise the length of the class names, such as class="btl bt btr br bbr bb bbl bl" which will minimise your typing.

    Use a preprocessor such as PPWizard. In PPWizard you could set up a deinition:

    #define mycurvedbox curvedboxtopleft curvedboxtop curvedboxtopright curvedboxright curvedboxbottomright curvedboxbottom curvedboxbottomleft curvedboxleft

    Then instead of writing:

    class="curvedboxtopleft curvedboxtop curvedboxtopright curvedboxright curvedboxbottomright curvedboxbottom curvedboxbottomleft curvedboxleft"

    You would just write:

    class="<$mycurvedbox>"

    For more on PPWizard see http://www.html-tags-guide.com/html-software.html

    Rather than use 8 separate classes, it may be easier to use the CSS3 border image properties. See: http://www.w3.org/TR/2002/WD-css3-border-20021107/...

    However if you do, you should check that it works in all of the browsers that your visitors are likely to use. For that you may want to use http://browsershots.org/

    Alternatively you could use the more usual approach of four areas or divs to cover a corner and side each with a background image that is longer than any conceivable top/bottom or side edge.

  • 1 decade ago

    To call multiple classes at once separate them by commas as demonstrated below.

    <style type="text/css">

    .class1, .class2, .class3 {color:#FFF;}

    </style>

    You can reference multiple classes for an element by separating them with a space as demonstrated below

    <div class="class1 class2 class3">Content</div>

    CSS is not a programming language in the traditional sense, so the term "function" does not apply here and so I'm not sure if this is the answer you're looking for.

Still have questions? Get your answers by asking now.