我想圖像更好的安排,而不是1列中的圖像。 請參閱附件中的示例,每篇文章的圖像可以在左側和右側。備用div有圖像左(偶)或右(奇數)
這是我的代碼。 HTML:
<section class="content list_page">
<article id="post-66">
<div class="list_img"><img src="img1.png"></div>
<div class="list_text">Content 1</div>
</article>
<article id="post-63">
<div class="list_img"><img src="img2.png"></div>
<div class="list_text">Content 2</div>
</article>
.
.
.
</section >
CSS:
.list_page:nth-child(odd) .list_img{
float:right;
}
.list_page:nth-child(even) .list_img{
float:left;
}
我該怎麼辦呢?請幫忙。 -Thanks提前
使用CSS屬性顯示:inline-block的;或顯示:內聯; – Sagar
不應''nth-child()'應用於'article'而不是'.list_page'? – BillyNate
@BillyNate是:\,我應該刪除這個問題嗎? –