我有一个造型问题,我正在使用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