html - float 左侧容器卡在中间

标签 html css position css-float

我有以下代码:http://jsfiddle.net/69MqZ/1/

如您所见,灰色文本行一直到灰色元数据:enter image description here

尽管左边的名字很长,但我希望它是这样的:enter image description here

显然它必须使用 position: relative 或某种技术来使 border-bottom 相应地移动。这是 WordPress 生成的评论输出。

我在这里面临同样的问题(所有容器都有 float: left;): enter image description here

最佳答案

您需要在评论作者姓名和元数据 周围包裹一个父元素 - .comment-author 和 .comment-meta - 然后 float 该父元素。例如:

 <div class="comment_author_wrap">
 <div class="comment-author vcard">
     <cite class="fn">John Smith</cite> <span class="says">says:</span>        
 </div>

 <div class="comment-meta commentmetadata">
     <a href="#comment-3">May 23, 2010 at 5:04 pm</a>&nbsp;&nbsp;<a title="Edit comment" href="3" class="comment-edit-link">(Edit)</a>        
 </div>
 </div>

然后

.comment_author_wrap {
   float: left;
 }

这将使评论文本如您所愿一直出现到该区域的顶部。

关于html - float 左侧容器卡在中间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10143306/

相关文章:

javascript - 如何防止 img src 无效,如果无效则保留以前的图像

html - 固定容器中的侧面导航

swift : Randomize UIButton Position within View

wpf - 如何将WPF ScrollViewer的内容滚动到特定位置

javascript - JQuery 获取不同行的选定选项值

jquery - jQM页脚在转换前后消失和出现

html - 小型设备的 Bootstrap 布局

css - 在 CSS 中设置用于调整背景图像大小的原点

css - 菜单不随站点缩放,在较小的显示器上,视频/照片偏向右侧

javascript - Angularjs 如何在 Google map 上使用 ng-Repeat 添加/删除动态输入表单?