嗨,我努力瞄準這個班,我不知道爲什麼。似乎第一個div會干擾第二個div上的僞選擇器。爲什麼不能用僞選擇器來定位這個類?
HTML
<div class="home-work">
<div class="home-work-header"><h3><span>test</span></h3></div>
<div class="home-work-container"><p>test</p></div>
<div class="home-work-container"></div>
<div class="home-work-container"></div>
</div>
CSS
.home-work-container {
width:100%;
margin:10px 20px;
background-color:grey;
height:250px;
&:first-of-type {padding:144px;}
}
https://jsfiddle.net/L0uoz531/
在此先感謝
':'是不是有效的CSS。那是一種CSS預處理器嗎? – j08691
請參閱http://stackoverflow.com/questions/6447045/css3-selector-first-of-type-with-class-name – Mike
是的,他正在使用SCSS。現在將編輯標籤。 – Frits