Solved

Including one css class within another

Posted on 2004-08-24
3
457 Views
Last Modified: 2013-11-18
Is there a way of including all the properties of one CSS class inside another. Like haing an include file reference on an asp page...

Thanks,

Jacob
0
Comment
Question by:jacobcolton
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 5

Expert Comment

by:webtrans
ID: 11879819
u can use the import tag inside ur CSS
below is an example

@import url(http://www.and.so.on.partial1.css);
0
 
LVL 18

Accepted Solution

by:
arantius earned 500 total points
ID: 11881297
The C in CSS stands for cascading.  If I have two separate classes that have all the same attributes except a few, I can specify it like this:

h1, h2 {
  font-style: italic;
  font-weight: bold;
  color: blue;
  border-bottom: 2px solid black;
}
h1 {
  font-size: 2em;
}
h2 {
  font-size: 1.5 em;
}

Then, h1 and h2 tags will have all the same font and color types, and just different sizes.  Is this what you mean?  Basically, you may separate any number of selectors with commas in your CSS declaration.
0
 
LVL 5

Expert Comment

by:pmsyyz
ID: 11883366
If you mean having two different classes apply to the same element, you use a space seperated list:

<p class="one two"></p>

If you mean including one css file inside another you can use @import as webtrans showed.
http://www.w3.org/TR/CSS21/cascade.html#at-import

@import url("mystyle.css");
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Does your audience prefer people in photos or no people? How can you best highlight what you’re selling? What are your competitors doing, and what can you do that is different and unique from them?  Continue reading to learn how to make your images …
When the s#!t hits the fan, you don’t have time to look up who’s on call, draft emails, call collaborators, or send text messages. An instant chat window is definitely the way to go, especially one like HipChat. HipChat is a true business app. An…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

718 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question