Seems like i should know this..
i have an element like this
am trying to access. i tried this but didn't workPHP Code:<span class="one two">Text here</span>
PHP Code:.one .two {
font-size:32px;
color:red'
}
Seems like i should know this..
i have an element like this
am trying to access. i tried this but didn't workPHP Code:<span class="one two">Text here</span>
PHP Code:.one .two {
font-size:32px;
color:red'
}
No, you can't specify a rule for elements with two specific classes. You could use the CSS you posted if you changed the HTML to:
But generally, it would probably be best to simply define another class entirely to keep the mark-up cleaner and easier to maintain.Code:<span class="one"><span class="two">Text here</span></span>
thank you very much,
really good to know, thanks
Yes you can apply more than one class to a div but only if the 2 classes have different style properties.
in your code, for example
Means that you want two classes with the same formatting (not sure why as classes can be re-used as many times as you like in a page unless each class has other styling separately within your CSS) and you are then applying both to your html which is completely unnecessary, howeverCode:.one .two {
font-size:32px;
color:red;
}
Means you are setting two different classes which have different properties and then you may need to apply both to your span as you have done.Code:.one {
font-size:32px;
color:red;
}
.two {
font-weight: bold;
}
You actually can have as many class rules as you wish as long as they are different and separated by spaces, i.e. class="one two third four". Suggest you limited the number of classes used for an element though. Might use CSS Lint Cleaner. Also...
CSS Formatter and Optimiser
The Greatest tool for sorting CSS properties in specific order
Thank you for another fantastic post. Where else could anybody get that kind of info in such an ideal way of writing? I have a presentation next week, and I'm on the look for such information. wish you luck