Solved

Including one css class within another

Posted on 2004-08-24
3
446 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
3 Comments
 
LVL 5

Expert Comment

by:webtrans
Comment Utility
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
Comment Utility
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
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
I've been asked to discuss some of the UX activities that I'm using with my team. Here I will share some details about how we approach UX projects.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

744 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now