Need Help Formatting with the code [closed]
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this questionOk I have been dying on this page...the code is below...if you can visit and see that it is not formatting right...I am wanting it to format in a way that it is all in line and not jumbled up like it is...what do I change in the code below...
Where one properity is below the other...u will see when you look at the site
http://ampmproperties.com/listing-of-properties-available
<style>
#para1{ text-align:center;}
.bdr_blb{
border:#000000 solid 4px;
height:70px;
background:#cccccc;
text-align:center;
font-size:14px; font-weight:700;}
.light32{ font-size:32px;}
.bggrey{ background:#cccccc;}
.light18{ font-size:18px;}
#bedroom4{
background:#cccccc;
}
.heading_div{float:left;}
.entry-content{float:left;}
.thumnail_col ul li {
float: left;
list-style: none outside none;
margin-right: 15px;
}
.thumnail_col ul li img{background:none; border:none;}
</style>
?>
<div id="container">
<div id="" role="main">
<?php $args = array( 'category_name' => 'lease', 'orderby' => 'title' ,'order' => 'ASC' );
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post();
if ($count==1)
{
echo "<tr>";
}
?>
<td><div class="lease">
<div class="heading_div"><h2 class="entry-title"><strong><u>
<?php
echo '<a href="'.get_bloginfo('url').'/lease/'.$loop->post->post_name.'" target="_blank">'.$loop->post->post_title.'</a>';
?>
</u></strong></div></h2>
<div class="entry-开发者_StackOverflowcontent">
<div class="desc">
<?php
the_content();
?>
</div>
</div></div></td>
<?php
if($count==$number_of_columns)
{
echo "</tr>";
$count=0;
}
$count++;
endwhile;
?>
</div><!-- #content -->
</div><!-- #container -->
You are floating elements in each of your lease divs. You can add the following css and it should sort things out. Although I think I would recommend entering an explicit <br style="clear: both;" />
after each entry-content instead. Although it still looks bad. Do you really want to have float: left on heading_div and entry-content at all?
.lease { clear: both; }
Should something be initialising "$count" and "$number_of_columns"? Looking at your current site, there seems to be quite a few opening/closing tags missing/in the wrong place; It may not be what is messing up the formatting, but they might help with web browser compatiblity etc...
精彩评论