Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 280
  • 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
Get 10% Off Your First Squarespace Website

Ready to showcase your work, publish content or promote your business online? With Squarespace’s award-winning templates and 24/7 customer service, getting started is simple. Head to Squarespace.com and use offer code ‘EXPERTS’ to get 10% off your first purchase.

 
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get 10% Off Your First Squarespace Website

Ready to showcase your work, publish content or promote your business online? With Squarespace’s award-winning templates and 24/7 customer service, getting started is simple. Head to Squarespace.com and use offer code ‘EXPERTS’ to get 10% off your first purchase.

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