css - Div 内容无法正确对齐,谁能帮我解决这个问题?

标签 css css-float

您好,所以我将我的 div 设置为 float ,右边是 worpress 新闻内容,左边是日期和评论气泡,唯一的问题是第二个帖子的日期在第一个帖子的日期旁边,我不知道这是为什么。

enter image description here

看看日期如何与第一个日期对齐,它不应该在那里,它应该与下面的帖子对齐并且下面帖子上的日期应该与第三个帖子对齐,下面是我的 css

#content {
width: 1070px;
}
.right{
position:relative;
float:right;
right:215px;
}

.left{
position:relative;
float:left;
left:200px; 
display:block;
}

.date{
width:80px;
margin: 0px 0px 0px 0px;
padding: 0px 0px 0px 0px;
}

.month {
color:#fff;
font-size:15px;
font-family:eurofurence;
text-transform:uppercase;  
}

.year {
color:#fff;
padding:0 0 7px 0;
font-size:30px;
font-family:eurofurence;
text-transform:uppercase;  
}

.commentbubble{
  background: url('http://bleedartmedia.com/mock/wp-content/themes/KellyRowland/images/commentb.png') no-repeat;
  width:40px;
  height:49px;
  padding:4px 0 0 14px;
 }
    .entry {
margin: 0px 0px 0px 0px;
padding: 0px 10px 0px 10px;
border-bottom: 0px solid #cccccc;
    font-family:eurofurence;
    font-size:17px;
    width:610px;
    background:#000;
}

    .entry-top {
margin: 0 0 0px 0;
padding: 0 0 0px 0;
text-align: left;

}

    .entry-top .entry-title {
color: #fff;
    font-family:eurofurence light;
    font-size:28px;
}

    .entry-top .entry-author {
font-style: italic;
}

    .entry-title {
margin: 0;
padding: 0;
font-size: 1.3em;
font-weight: bold;
line-height: normal;
font-stretch: narrower;
}

    .entry-title a:link,
    .entry-title a:visited {
color: #fff;
    font-family:eurofurence light;
    font-size:28px;
}

    .entry-title a:hover {
color: #3E7AB9;
text-decoration: none;
}

    .entry-content {
margin: 10px 0 10px 0;
padding: 0px 10px 10px 10px; 
    font-family:eurofurence;
    font-size:17px;
}

这是编码

    <div id="content">
    <?php while ( have_posts() ) : the_post() ?>

  <div class="date left">
     <div class='month'><?php the_date('M');?></div>
     <div class='year'><?php the_time('d');?></div>

     <div class="commentbubble">
   <?php comments_popup_link( __( '0', 'wpbx' ), __( '1', 'wpbx' ), __( '%', 'wpbx' ) ) ?>
      </div>
      Comments
    </div>


            <div class="entry right">
    <div class="entry-top">
            <h2 class="entry-title"><?php the_title() ?></h2>
    </div>
            <div class="entry-content clearfix">

        <div class="entry-content">
                <div id="text"><?php the_content() ?></div>
                </div>

            </div>
            <div class="entry-meta">

            </div>

    </div><!-- .post -->
      <br>
      <?php endwhile; ?>

    </div><!-- #content -->

谁能帮我解决这个问题

最佳答案

添加

.entry:after {
    clear: both;
}

关于css - Div 内容无法正确对齐,谁能帮我解决这个问题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12692120/

相关文章:

css - 无法在 JavaFX 组合框中自定义文本填充

CSS - 有色不透明度

html - 正确使用 Floats(对于那些喜欢 CSS 标准的人)?

css - 如何创建网格/平铺 View ?

css - 我可以让 div 在页面上向下流动而不是穿过它吗?

css - 在 Angular2 组件中导入 SASS 部分

c# - 有没有办法使用 html 字符串删除 margin pdf 报告?

CSS向左浮动和定位元素

css-float - float Div 列,最左侧固定

Javascript - Div标签自动关闭