我对此代码有一个小的HTML问题:
<div id="primary">
<div id="content" role="main">
<div class="astro"><img class="astro" src="<?php echo get_template_directory_uri() . '/images/astro.png'; ?>" alt="Astro" />
</div>
<div class="planet"><img class="planet" src="<?php echo get_template_directory_uri() . '/images/planet.png'; ?>" alt="Planet" />
</div>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<h1 class="entry-title"><a href="/learcenter/?page_id=13"><?php echo $page_data->post_title; ?></a></h1>
<div class="entry-content"><?php echo $page_data->post_excerpt; ?>
<a href="/learcenter/?page_id=13">Read More...</a>
</div>
</article>
<div id="tour-center">
<h1 class="entry-title">Tour Our Center</h1>
</div>
<div id="news-section-title">
<h1 class="entry-title"><a href="<?php echo esc_url( get_permalink( get_page_by_title( 'Challenger News' ) ) ); ?>"><?php echo get_the_title(75); ?></a></h1>
<div class="hr"></div>
</div>
<div class="news">
<div class="rss-news">
<a href="#"><img src="<?php echo get_template_directory_uri() . '/images/rss.png'; ?>" alt="RSS" />
</a>
</div>
</div>
<div class="news">
<div class="rss-news">
<a href="#"><img src="<?php echo get_template_directory_uri() . '/images/rss.png'; ?>" alt="RSS" />
</a>
</div>
</div>
<div class="news">
<div class="rss-news">
<a href="#"><img src="<?php echo get_template_directory_uri() . '/images/rss.png'; ?>" alt="RSS" />
</a>
</div>
</div>
</div><!-- #content -->
</div><!-- #primary -->
我删除了div之间的一些PHP代码,以便HTML更加明显。问题是内容div在news-section-title div之后就停止了,我无法弄清楚原因。它应该延伸到文档的末尾,其中结束div是。您可以在此website上查看代码。
答案 0 :(得分:1)
只需将此样式添加到您的内容div
即可#content {
float:left;
}
答案 1 :(得分:0)
div
将不会包装float
ed元素。尝试将overflow: hidden
添加到content
div
。