Solved

Simple referencing a class in css

Posted on 2011-03-24
8
269 Views
Last Modified: 2012-08-13
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
Comment
Question by:PagodNaUtak
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
8 Comments
 
LVL 40

Accepted Solution

by:
gurvinder372 earned 500 total points
ID: 35204975
since deselected and chkbox are two different classes
span.chkbox
{
}

span.deselected
{
}

0
 
LVL 40

Expert Comment

by:gurvinder372
ID: 35204981
if you want to give them the same style (or a common style), then
span.chkbox, span.deselected
{
}
0
 
LVL 2

Expert Comment

by:JanEnEm
ID: 35205071
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
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

 
LVL 8

Author Comment

by:PagodNaUtak
ID: 35205179
I want to apply a css to a div having the class checkbox and deselected
0
 
LVL 40

Expert Comment

by:gurvinder372
ID: 35205196
did you tried my solution?
0
 
LVL 2

Expert Comment

by:JanEnEm
ID: 35205285
@qurvinder: Are you saying you want two class to one div/span?

Or do you want a class "selected'  and a class "deselected"?
0
 
LVL 40

Assisted Solution

by:gurvinder372
gurvinder372 earned 500 total points
ID: 35205314
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
 
LVL 2

Expert Comment

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

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…
In this tutorial viewers will learn how to customize the background color and font color of highlighted text using the ::selection element in CSS Begin by defining the selected text as an element in CSS by typing "::selection": Style the ::selection…

730 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