CSS selector to select element that has this id and this class
Can you select an element with CSS that has a certain id and a certain class?
Something like t开发者_如何学JAVAhis I suppose:
#id.class {
color: blue;
}
Let's say you have a class
people
. Their background-color
is white
. But if you refer to special people like alice
or bob
, you can use IDs to make them look special.
.people {
background-color: white;
}
.people#alice {
text-transform: capitalize;
}
.people#bob {
text-transform: uppercase;
}
What are your intentions? If you want to have a generic people class and special alice and bob you could also use:
CSS:
.people {
background-color: white;
}
#alice {
text-transform: capitalize;
}
#bob {
text-transform: uppercase;
}
and HTML:
<div class="people" id="alice">Alice</div>
<div class="people" id="bob">Bob</div>
精彩评论