Solved

Simple referencing a class in css

Posted on 2011-03-24
8
266 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
  • 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
 
LVL 8

Author Comment

by:PagodNaUtak
ID: 35205179
I want to apply a css to a div having the class checkbox and deselected
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer …
CSS is a visual language used to classify objects and define rules about how they should be displayed. CSS skills aren’t restricted to developers anymore, there is a big benefit to having a basic understanding of the language, regardless of your occ…
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
In this tutorial viewers will learn how to style a decorative dropcap for the first letter in a paragraph using CSS. In CSS, create a new paragraph class by typing "p.fancy": Then, to style only the first letter of the first sentence, include the ps…

948 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now