div.alert.error {
background:url("v3.png") no-repeat scroll 7px -643px #FFEEEE;
}
Does the selector "div.alert.error" mean the following?
select DIVs that contain both class alert and error.
Is there a different between
CaseI: div.alert.error
CaseII: div.alert .error
CaseIII: div .alert .error
Thank you
Simple selectors (select elements based on name, id, class) Combinator selectors (select elements based on a specific relationship between them) Pseudo-class selectors (select elements based on a certain state)
The Universal Selector is the * in CSS. Literally the asterisk character. It is essentially a type selector that matches any type. Type meaning an HTML tag like <div> , <body> , <button> , or literally any of the others. A common use is in the universal reset, like this: * { margin: 0; padding: 0; }
A type selector selects all HTML elements that have a given node name. For example, “a” would select all <a> elements and apply the CSS property values to them. “Input” would select all <input> elements, “span” all <span> elements and so on.
CaseI: div.alert.error
A div with classes alert
AND error
. <div class="alert error">
CaseII: div.alert .error
An element with class error
that is a descendant of a div with class alert
.
CaseIII: div .alert .error
An element with class error
that is a descendant of an element with class alert
, that in turn is a descendant of any div.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With