[英]What is the selector class for div inside another div
我正在嘗試為 Menu 類應用樣式。 但是,當我將一些 CSS 屬性寫入菜單時,樣式並沒有應用。 如何在另一個 div 中選擇確切的 CSS 類 div 到標題中的 div,如下面的代碼
<section class="showcase">
<header>
<img src="assets/images/logov2.png" alt="company-Logo" style="width:160px;height:20px;">
<div class="menu">
<ul>
<li><a href="#">How it works</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Team</a></li>
<li><a href="#">Contact</a></li>
</ul>
</div>
<div class="Access">
Get Early Access
</div>
</header>
</section>
只需使用標簽header
作為到達其他選擇器的起點。
header>img { height: 220px; width: 300px; } header>.menu { background-color: red; } header>.Access { padding: 10px; background-color: yellow; }
<section class="showcase"> <header> <img src="https://images.unsplash.com/photo-1554232456-8727aae0cfa4?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=735&q=80" alt="company-Logo"> <div class="menu"> <ul> <li><a href="#">How it works</a></li> <li><a href="#">About</a></li> <li><a href="#">Team</a></li> <li><a href="#">Contact</a></li> </ul> </div> <div class="Access"> Get Early Access </div> </header> </section>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.