ある要素から次の要素への垂直方向のオフセット (170px っぽい) が非常に大きい理由を理解するのに苦労してい<li>
ます。これは Chrome では表示されますが、Firefox では表示されません。PHP が存在する場合にのみ<li>
要素で発生します。<p>
最初の<li>
要素からタグを削除するか、2 番目の要素の PHP を削除するか、 タグとタグforeach
のスタイルを削除すると、オフセットはなくなります。以下にcssを入れておきます。<p>
<a>
どんな助けでも大歓迎です。
ありがとう、スティーブ
<ul class="gridRow">
<li class="cell-2-4 first-child linkBox">
<a href="<?php echo site_url(); ?>/pianos/" class="pianosLarge">Pianos</a>
<p>other Links</p>
</li>
<li class="cell-2-4 last-child">
<div class="home-news">
<?php foreach ($recentposts as $post) : {
setup_postdata($post);?>
<h2><?php the_title();?></h2>
<?php the_content();?><?php
}
endforeach;
wp_reset_query();?>
</div>
</li>
</ul>
CSS:
.gridRow li {
height:100%;
display:inline-block;
margin-left: -4px;
margin-right: 30px;
overflow: auto;
}
.cell-2-4 {
width: 474px;
}
.linkBox a {
display: block;
height: 225px;
padding: 0.6em;
font-size: 2em;
}
.linkBox p {
padding: 0 1em 0 1em;
border-top: 1px solid lightgray;
}
li.first-child {
margin-left: 0;
}
li.last-child {
margin-right: 0;
}
EDIT:stackErr によって要求された $recentposts の var_dump:
object(WP_Post)#288 (24) { ["ID"]=> int(54) ["post_author"]=> string(1) "1" ["post_date"]=> string(19) "2013-06 -24 10:23:20" ["post_date_gmt"]=> string(19) "2013-06-24 10:23:20" ["post_content"]=> string(64) "ここ siteName ではデスカントを販売しています。高音レコーダー ..." ["post_title"]=> string(33) "新学期のレコーダー" ["post_excerpt"]=> string(0) "" ["post_status"]=> string(7) " publish" ["comment_status"]=> string(4) "open" ["ping_status"]=> string(4) "open" ["post_password"]=> string(0) "" ["post_name"]=> string(11) "tune-pianos" ["to_ping"]=> string(0) "" ["pinged"]=> 文字列(0) "" ["post_modified"]=> 文字列(19) "2013-06-24 10:31:37" ["post_modified_gmt"]=> 文字列(19) "2013 -06-24 10:31:37" ["post_content_filtered"]=> string(0) "" ["post_parent"]=> int(0) ["guid"]=> string(34) "t/grandpianos/ ?p=54">http://localh_t/grandpianos/?p=54" ["menu_order"]=> int(0) ["post_type"]=> string(4) "post" ["post_mime_type"]= > string(0) "" ["comment_count"]=> string(1) "0" ["filter"]=> string(3) "raw" }string(19) "2013-06-24 10:31:37" ["post_content_filtered"]=> string(0) "" ["post_parent"]=> int(0) ["guid"]=> string(34 ) "t/grandpianos/?p=54">http://localh_t/grandpianos/?p=54" ["menu_order"]=> int(0) ["post_type"]=> string(4) "post" ["post_mime_type"]=> string(0) "" ["comment_count"]=> string(1) "0" ["filter"]=> string(3) "raw" }string(19) "2013-06-24 10:31:37" ["post_content_filtered"]=> string(0) "" ["post_parent"]=> int(0) ["guid"]=> string(34 ) "t/grandpianos/?p=54">http://localh_t/grandpianos/?p=54" ["menu_order"]=> int(0) ["post_type"]=> string(4) "post" ["post_mime_type"]=> string(0) "" ["comment_count"]=> string(1) "0" ["filter"]=> string(3) "raw" }post_mime_type"]=> string(0) "" ["comment_count"]=> string(1) "0" ["filter"]=> string(3) "raw" }post_mime_type"]=> string(0) "" ["comment_count"]=> string(1) "0" ["filter"]=> string(3) "raw" }