.collumnWapprer{
display: flex;
flex-direction: row;
}
.collumnContent{
position: relative;
width: 200px;
height: 1000px;
text-align: left;
margin: 3px;
**background-color: red;**
}
.collumnContent:nth-child(1){
background-color: rgba(0, 0, 0, 1);
}
.collumnContent:nth-child(2){
background-color: rgba(0, 0, 0, 0.95);
}
.collumnContent:nth-child(3){
background-color: rgba(0, 0, 0, 0.90);
}
.collumnContent:nth-child(4){
background-color: rgba(0, 0, 0, 0.85);
}
.collumnContent:nth-child(5){
background-color: rgba(0, 0, 0, 0.80);
}
.collumnContent:nth-child(6){
background-color: rgba(0, 0, 0, 0.75);
}
.collumnContent:nth-child(7){
background-color: rgba(0, 0, 0, 0.70);
}
.collumnContent:nth-child(8){
background-color: rgba(0, 0, 0, 0.65);
}
.collumnContent:nth-child(9){
background-color: rgba(0, 0, 0, 0.60);
}
.collumnContent:nth-child(10){
background-color: rgba(0, 0, 0, 0.55);
}
.collumnContent:nth-child(11){
background-color: rgba(0, 0, 0, 0.50);
}
.collumnContent:nth-child(12){
background-color: rgba(0, 0, 0, 0.45);
}
<div class="collumnWapprer">
<div class="collumnContent"></div>
<div class="collumnContent"></div>
<div class="collumnContent"></div>
<div class="collumnContent"></div>
<div class="collumnContent"></div>
<div class="collumnContent"></div>
<div class="collumnContent"></div>
<div class="collumnContent"></div>
<div class="collumnContent"></div>
<div class="collumnContent"></div>
<div class="collumnContent"></div>
<div class="collumnContent"></div>
</div>
指定正確的類。類應該描述內容,例如「人口」或「分數」。然後很容易爲每個分配不同的樣式。另一方面,如果您只想交替與內容無關的顏色,則可以使用[:nth-of-type](https://developer.mozilla.org/en/docs/Web/CSS/:nth-of-類型)或:第n個孩子。另外,請記住,您可以將多個類分配給單個元素。 – spectras
小心第一個div class「collumnContent」的小錯字:class而不是sclass – Aigloun
@andreas:請不要爲了填充而添加標籤。 – BoltClock