HTML代码:
<html class="mobile portrait">
<body>
<div>
<header>
<img class="company_logo">
</header>
<section>
<div>
<img class="company_logo">
</div>
</section>
<footer>
<img class="company_logo">
</footer>
</div>
</body>
</html>
为了display: none;
,我如何在.company_logo
期间将一条规则应用于.mobile .portrait
?:
更新 :编辑HTML代码以添加多个company_logo
。代码已从问题中删除:
/* CSS code */
.mobile .portrait > body > div > header > .company_logo {
display: none;
}
答案 0 :(得分:4)
/* Matches elements with the class of company_logo that are
inside an element with both "mobile" and "portrait" classes */
.mobile.portrait .company_logo {
/* style here */
}