When using css, how can I specify a nested class.
Here is my html code:
-
In CSS, classes need to be prefixed by a ., ids need to be prefixed by #, and elements don't need to be prefixed at all.
This is how you need to declare your CSS:
.box1 .box-body i {
width: 30px;
}
Note that box1 and box-body are both classes, while i is an element.
Example:
I have listed three different elements. This is how they would be accessed in CSS:
// first div
.class {
[some styling]
}
// second div
#id {
[some styling]
}
// third div
div {
[some styling]
}
- 热议问题