• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 274
  • Last Modified:

Simple referencing a class in css

I have a span like this:

<span class="chkbox deselected">

</span>

is the below code is how you reference the span in CSS?

span.chkbox.deselected{

float:left;

}
0
PagodNaUtak
Asked:
PagodNaUtak
  • 4
  • 3
2 Solutions
 
Gurvinder Pal SinghCommented:
since deselected and chkbox are two different classes
span.chkbox
{
}

span.deselected
{
}

0
 
Gurvinder Pal SinghCommented:
if you want to give them the same style (or a common style), then
span.chkbox, span.deselected
{
}
0
 
JanEnEmCommented:
Although I believe there is no restriction as to use spaces in a className, in this situation I would avoid using spaces.
Hence leave the spaces out and call the class "checkboxSelected"

The CSS selector would then be
 span.checkboxSelected
{
}
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
PagodNaUtakAuthor Commented:
I want to apply a css to a div having the class checkbox and deselected
0
 
Gurvinder Pal SinghCommented:
did you tried my solution?
0
 
JanEnEmCommented:
@qurvinder: Are you saying you want two class to one div/span?

Or do you want a class "selected'  and a class "deselected"?
0
 
Gurvinder Pal SinghCommented:
yes.
Since in the original question, he specified two classes, and also clarified that he wants to apply the style to a div with two classes.

You can always specify multiple classes for any element, see the specification here
http://www.w3.org/TR/html401/struct/global.html#h-7.5.2

0
 
JanEnEmCommented:
Communications was too async. I agree with the comments Qurvinder made.
His CSS suggestions are OK!
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now