亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

為什么我的nth-child(n)無法選中元素

<section?class="gray-section">
????<div?class="article-preview">
????????<div?class="img-section">
????????????<img?src="assets/pic01.jpg"/>
????????</div>
????????<div?class="text-section">
????????????<h3>又一個標題</h3>
????????????<div?class="sub_heading">又一個子標題</div>
????????????<p>Lorem?ipsum?dolor?sit?amet,?consectetur?adipisicing?elit.?Amet?dolores?eveniet?nisi?reprehenderit
????????????????similique?suscipit?tempore.</p>
????????</div>
????</div>
????<div?class="article-preview">
????????<div?class="text-section">
????????????<h3>又一個標題</h3>
????????????<div?class="sub_heading">又一個子標題</div>
????????????<p>Lorem?ipsum?dolor?sit?amet,?consectetur?adipisicing?elit.?Amet?dolores?eveniet?nisi?reprehenderit
????????????????similique?suscipit?tempore.</p>
????????</div>
????????<div?class="img-section">
????????????<img?src="assets/pic02.jpg"/>
????????</div>
????</div>
????<div?class="article-preview">
????????<div?class="img-section">
????????????<img?src="assets/pic03.jpg"/>
????????</div>
????????<div?class="text-section">
????????????<h3>又一個標題</h3>
????????????<div?class="sub_heading">又一個子標題</div>
????????????<p>Lorem?ipsum?dolor?sit?amet,?consectetur?adipisicing?elit.?Amet?dolores?eveniet?nisi?reprehenderit
????????????????similique?suscipit?tempore.</p>
????????</div>
????</div>
</section>
.gray-section{
????background:?#30363e;
}
.gray-section:nth-child(odd){
????background-color:rgba(255,255,255,.1);
}

.article-preview:after?{
????content:?"";
????display:?block;
????clear:?both;
}
.img-section?{
????width:?45%;
????font-size:0;
}

.img-section?img?{
????width:?100%;
}

.text-section?{
????position:?relative;
????top:?40px;
????left:?40px;
????width:?55%;
????letter-spacing:?1px;
????color:?#fff;
}

.text-section?>?*?{
????max-width:?90%;
}

.text-section?.sub_heading?{
????margin-top:?20px;
}
.article-preview?>?div?{
????float:?left;
}

查看chrome控制臺發現樣式沒有應用到元素上

正在回答

1 回答

把樣式寫在標簽上是有效果的,用這個選擇器設置任何樣式都無效

0 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消
HTML5和CSS3扁平化風格博客
  • 參與學習       86790    人
  • 解答問題       406    個

HTML5與CSS3搭建超酷扁平化風格博客

進入課程

為什么我的nth-child(n)無法選中元素

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號