我有一個造型問題,我正在使用WordPress,並希望有前兩個類完全不同於其他類。nth類型只爲1和2工作
我理想的情況是有:
.si-biplace:nth-of-type(3) { float:left; margin:20px 0px 0px 0px; }
.si-image:nth-of-type(3) { float:left; margin:20px 0px 0px 0px; border:0px; }
.si-title:nth-of-type(3) { width:100px; height:20px; margin:0px; font-size:7px; color:#FFFFFF; font-weight:bold; }
他們似乎正常工作時,它是:
.si-biplace { float:left; margin:-10px 0px 0px 0px; }
.si-biplace:nth-of-type(2) { float:left; margin:-10px 0px 0px 15px; }
是否有一個原因,它不會與工作的第n-的類型( 3)但會與第2類的第n個?我基本上需要使用div的每個下一次不同的屬性,但不能有單獨的div類,因爲它通過php數組運行。
這是我的HTML & PHP結構櫃面我做錯了什麼:
<div class="si-biplace">
<div class="si-image">
<a href="http://universitycompare.com:8888/945/test/">
<img width="340" height="170" src="http://universitycompare.com:8888/wp-content/uploads/2012/09/post-test.png" class="attachment-si-images wp-post-image" alt="post-test" title="post-test"/></a>
</div>
<div class="si-title">
<a href="http://universitycompare.com:8888/945/test/">Testing Post Article Number1</a>
</div>
<div class="si-date">
Date: <a style="color:#154157;" href="http://universitycompare.com:8888/945/test/">
September 6, 2012 </a>
</div>
</div>
<div class="si-biplace">
<div class="si-image">
<a href="http://universitycompare.com:8888/28/what-graduates-need-to-know-about-creative-internships/">
<img width="340" height="170" src="http://universitycompare.com:8888/wp-content/uploads/2012/09/post-test.png" class="attachment-si-images wp-post-image" alt="post-test" title="post-test"/></a>
</div>
<div class="si-title">
<a href="http://universitycompare.com:8888/28/what-graduates-need-to-know-about-creative-internships/">What graduates need to know about creative internships</a>
</div>
<div class="si-date">
Date: <a style="color:#154157;" href="http://universitycompare.com:8888/28/what-graduates-need-to-know-about-creative-internships/">
July 3, 2012 </a>
</div>
</div>
<div class="si-biplace">
<div class="si-image">
<a href="http://universitycompare.com:8888/25/students-say-they-will-work-for-free-after-graduating/">
<img width="340" height="170" src="http://universitycompare.com:8888/wp-content/uploads/2012/09/post-test.png" class="attachment-si-images wp-post-image" alt="post-test" title="post-test"/></a>
</div>
<div class="si-title">
<a href="http://universitycompare.com:8888/25/students-say-they-will-work-for-free-after-graduating/">Students say they will work for free after graduating</a>
</div>
<div class="si-date">
Date: <a style="color:#154157;" href="http://universitycompare.com:8888/25/students-say-they-will-work-for-free-after-graduating/">
July 3, 2012 </a>
</div>
</div>
你可以展示一個[demo](http://jsfiddle.net/)來重現這個問題嗎? –
不幸的是,但我剛剛更新我的問題與我的HTML結構incase這是錯誤的基礎上我的CSS? –
從瀏覽器的「查看源代碼」選項中包含*生成的HTML總比PHP更好,它可能會生成*任何東西*就我們而言 – Gareth