is it possible to concatenate in the css file ???
Main Topics
Browse All TopicsHi all css expert,
I'm seeking for a way to concatenate to css class but don't know how to di it. Could someone help me.
Here's an example of what I want to do :
.classone{
font-size:10pt;
font-weight:bold;
color:#000000;
}
.classtwo{
background-color:#F1F1F1;
}
would like to be able to call them together in my html page something like this :
<font class=".classone"+".classt
I know that my example as no sense but I would like to be able to concatenate two different class for the same object, in this case <font>.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Actually, some other ways would be:
1)
#someid
{
font-size: 10pt;
font-weight: bold;
color: #000000;
}
.someclass
{
background-color: #F1F1F1;
}
<span id="someid" class="someclass">Some text...</span>
2)
p
{
font-size: 10pt;
font-weight: bold;
color: #000000;
}
p.someclass
{
background-color: #F1F1F1;
}
<p class="someclass">Some text...</p>
3)
styles1.css:
font.someclass
{
font-size: 10pt;
font-weight: bold;
color: #000000;
}
styles2.css:
@import (styles1.css)
font.someclass
{
background-color: #F1F1F1;
}
<link rel="stylesheet" type="text/css" href="styles1.css" />
<font class="someclass">Some text...</font>
Hope that helps ^_^
-- Jeex
Each declaration in a style sheet is a rule. The rules can be accessed and modified with script.
NOTE: If you put an id on the style tage you can reference it as: document.styleSheets['some
function modRule()
{
if (!document.styleSheets) return;
var mycss = new Array();
if (document.styleSheets[0].c
{
mycss = document.styleSheets[0].cs
}
else
{
mycss = document.styleSheets[0].ru
}
mycss[5].style.fontSize = '12pt';
}
The way the value is set is non-standard. The standard calls for:
document.styleSheets[5].cs
But that is not widly support; is wonky where it is supported, and is more difficult. I prefer the simple way.
Cd&
Font tags don't have styles. Styles REPLACE font tags.
YOu didn't say where you wanted the background color applied, or why, or if it would need to be dynamic, or if you just wanted a way to apply it to something.
All are possible.
This would be an easy way.
<div class="classtwo"><span class="classone">text goes here</span></div>
Or you could do this...
.classone{
font-size:10pt;
font-weight:bold;
color:#000000;
}
.classtwo{
background-color:#F1F1F1;
}
.classthree{
font-size:10px;
font-weight:bold;
color:#000000;
background-color:#F1F1F1;
}
Note -- PX instead of pt. And you NEVER use a style on a font tag. NEVER.
The second class cascades over the first and has priority. Sort of like what happens when you put a:visited after a:hove in the declarations. It will work that way but you have to be careful, and it makes it more difficult to maintain; especially if the two classes are coming from external stylesheets.
Cd&
The example given by deschesp does not have any conflicting declarations in both classes.
I forget where I first came across calling two (or more) classes together (might have been here: http://dhtmlnirvana.com/co
This question has been classified abandoned. I will make a recommendation to the
moderators on its resolution in a week or two. I appreciate any comments
that would help me to make a recommendation.
<note>
Unless it is clear to me that the question has been answered I will recommend delete. It is possible that a Grade less than A will be given if no expert makes a case for an A grade. It is assumed that any participant not responding to this request is no longer interested in its final disposition.
</note>
If the user does not know how to close the question, the options are here:
http://www.experts-exchang
Cd&
Business Accounts
Answer for Membership
by: JeexPosted on 2003-05-16 at 11:52:10ID: 8542578
Hi,
An element (in your case <font>) can only have a single class attribute. However, thanks to the cascading property of CSS, you could do this:
<font class="classone"><font class="classtwo">Some text...</font></font>
It's not beautiful, but it'll accomplish what you're after without the need to change your CSS.