Using multiple CSS classes

I have looked for this answer for a long time and very relieved to finally have the answer! If you’re like me, you want to be able to set up CSS classes, and ulimately combine or include other classes. But since you can’t include a class in another class (as far I know) – and when I searched for answers like this: http://www.google.com/search?hl=en&q=include+CSS+class the results always explained how to link to multiple CSS files, not how to include multiple classes. Until I ran across the second entry from that google link above.
 
It turns out, I was searching for my answer from the wrong direction. I was thinking that I could make a CSS class include other classes. But it turns out, how this is really used – is you can POINT to multiple CSS classes, from HTML!! I didn’t know this was possible. So, instead of doing something distasteful like this:

.Header

{

      background-color: #888899;

      color: White;

}

.Outline

{

      border: solid 1px #7d7d7d;

}

.HeaderWithOutline

{

      background-color: #888899;

      color: White;

      border: solid 1px #7d7d7d;

}

I just learned that you can have an element point to multiple CSS classes – just space-seperated, like this:
 

    <table>

        <tr>

            <td class="Header Outline">

            </td>

        </tr>

    </table>

Which means you don’t have to have a bunch of nasty repeating code in your CSS file and you can make primitive CSS classes and incorporate whichever ones you need for that particular element. Very cool!
Posted in ASP.NET, Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Archives
Categories

Enter your email address to follow this blog and receive notifications of new posts by email.

Join 2 other followers

%d bloggers like this: