我想在现有的网站上整合一小段,我的问题看起来很简单,但我似乎无法摆脱它的困扰。这里是我希望它看起来像:foreachloop中的水平div布局
alt text http://img691.imageshack.us/img691/329/layouth.jpg
蓝= #pagecontainer
红色= #sectioncontainer
黄色=。员额
pagecontainer { height: 100%; width: 900px;}
post container {width: 900px;}
.post {width: 210px;}
4个员额正从WordPress的拉入使用:
<?php if (have_posts()) : ?>
<?php query_posts('category_name=Category&posts_per_page=4'); ?>
<?php while (have_posts()) : the_post(); update_post_caches($posts); ?>
<div class="post">
<?php the_content() ?>
</div>
<?php endwhile; ?>
该帖子将是一个固定的宽度,但高度不一。问题是,如果没有最后一个帖子推下一个div,我不能在其间插入分隔符,也不能使用分隔符,因为第一个和最后一个div碰到页面容器。
我大概可以使用类似
.post {margin-right: 20px;}
.post:last-child {margin: 0 !important;}
...但是这似乎只是乱,我宁愿避免使用儿童伪选择。
整数解决方案的任何想法?
冠军!谢谢。比必须使用负边界更好。 – theorise 2010-05-11 13:41:30