Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

<span> question.

Status
Not open for further replies.

eharris

Programmer
Mar 13, 2001
15
0
0
Is it possible to include more than one CSS call into a single <span> element?

Suppose you wanted to modify a pre-defined class element to include bold and italic. Within your HTML you could include <span class=&quot;bold&quot;> (assuming you defined &quot;bold&quot;), but then how do you also include the &quot;italic&quot; you desired?

Can you do <span class=&quot;bold, italic&quot;> or something like that?

Assistance is appreciated.

Ed

 
<style>

.red {color:red;}
.attention {font-weight:bold;font-size:16pt}

</style>

<span class=&quot;red attention&quot;>css test</span> jared@eae.net -
 
jaredn:

That easy. Super, thank you.

I assume this solution will work with a foobar.css imported style sheet?

Thanks again.

Ed
 
I'm not sure the the use of multiple classes is cross-browser compatible. A more portable solution is to nest the spans like this:
Code:
<span class=&quot;attention&quot;><span class=&quot;red&quot;>css test</span></span>
I know it's cumbersome, but it more reliably portable. I've had problems with multiple-class use. Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
Why not <span class=&quot;attention&quot; id=&quot;red&quot;>Css</span> ?
 
Using a class and id will work, but I'm not sure how portable that is either. Besides, don't your style names have to start with # to use them in id=&quot;...&quot;? Wouldn't that mean that you couldn't ALSO use them in a class=&quot;...&quot;? Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top