Solved

Including one css class within another

Posted on 2004-08-24
3
447 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

911 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

17 Experts available now in Live!

Get 1:1 Help Now