例如,我可以通过以下两种方法获得相同的结果。
<html>
<head>
<style type="text/css">
p#red{color:red} /* This is a CSS id selector*/
p.green{color:green} /* This is a CSS class selector*/
</style>
</head>
<body>
<p id="red">red color</p>
<p cla
是否有css方法来选择X类型的元素,这些元素是在元素Y类型之后包含Z型元素的?
给定以下html,我只能在Z类型之后,而不是在包含Z的Y类型之后。
.y .z:after {
color: green;
/* x is not green because it's after y, not z */
}
<span class="y">
y
<span class "z">
z
</span>
</span>
<span class="x">