html - div 大小不计入右浮动元素

标签 html css layout css-float

我想要这样的内容

News Event Title                     11.11.2015
-----------------------------------------------
News Event Title 2345 News Event Title 2345 
                                     11.11.2015
-----------------------------------------------
News Event Title News Event Title News Event Ti
tle                                  11.11.2015

结果是这样

News Event Title                     11.11.2015
-----------------------------------------------
News Event Title 2345 News Event Title 2345
----------------------------------------------- 
                                     11.11.2015
News Event Title News Event Title News Event Ti
tle                                  11.11.2015

请注意实际结果中的第二个标题。这是因为日期是 float: right 并且不计入 div 大小。

如何解决?感谢您的帮助

代码是这样的

<div style="border-bottom:1px dotted #000000;">
<p>News Event Title<span style="float:right;">11.11.2015</span></p>
</div> 

更新:

请查看演示站点,左下角

更新

Overflow:hidden 解决问题。非常感谢

最佳答案

您可以在父 div 上添加 overflow: hidden;

关于html - div 大小不计入右浮动元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31718799/

相关文章:

javascript - 具有覆盖的 Div 不会在 Chrome 中滚动

html - Z-index 问题不知道现在该怎么办

javascript - 步进动画不适用于速度进度

css - 将多个 div 重新对齐到一个固定的 div

java - 将顶部与 JPanel 中新行中的每个元素垂直对齐

html - 在边框折叠表中使边框长度相同

html - 在底部放置两个 div block

html - 是否可以将 HTML 属性应用于 CSS 中的 Div 标签?

html - 在中心对齐 div 不起作用

java - 调整标签、文本字段和按钮大小