0
我對某些div和標籤用法感到困惑。我知道我可以用.class1.class2
鏈接兩個類,我可以使用.class1 h1
選擇所有具有class1
類的h1元素,p.class1
選擇具有class1
類的p元素,但是我想使用類似button
的類並在不同的div中使用它,但是I不知道如何區分CSS代碼。在幾個不同的類中使用通用類
.header {
height: 222px;
background-color: white;
width: 100%;
}
.container {
position: relative;
text-align: center;
top:50%;
transform: translateY(-50%);
}
.container h1 {
font-size: 48px;
font-family: 'Oswald', sans-serif;
font-weight: 700;
text-transform: uppercase;
}
.container h2 {
font-size: 16px;
font-family: 'Oswald', sans-serif;
font-weight: 200;
}
<div class="header">
<div class="container">
<h1>jane bloglife</h1>
<h2>Welcome to the world of Jane's world</h2>
</div>
</div>
<div class="front-image">
<div class="container">
<h1>Jane's</h1>
<h2>Fashion Blog</h2>
<div class="button"> <a href="">suscribe</a></div>
</div>
</div>
我想區分用container
類是header
類中從其他container
類是front-image
類