html - CSS float Div 和页脚?

标签 html css

我有这个:

enter image description here

如您所见,顶部有两个 float div,底部有一个实心 div。但是实心 div(页脚)隐藏在两个 float div 之下。

我怎样才能让它停留在两个 float div 的下面,而不是像在 imgur 上那样在它们里面?

.left {
  float:left;
  width:300px;
}
.right {
  float:right;
  width:300px;
}
.footer {
  width:600px;
}

最佳答案

clear:both; 添加到页脚规则。

.footer {
  width:600px;
  clear:both;
}

https://developer.mozilla.org/en-US/docs/Web/CSS/clear

关于html - CSS float Div 和页脚?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32097614/

相关文章:

javascript - 定位一个复选框并使用 Jquery 删除它

html - 移动设备未读取媒体查询

html - 如何使用 Controller 和 View 在 codeigniter4 中应用表单验证?

javascript - 如何通过 JQuery/Javascript 将选定的下拉菜单值正确传递给 JSON 函数

javascript - 如何使 <iframe> 在 WordPress 中响应。我只能让它在移动设备或桌面设备上响应。需要它在两个方面都能很好地工作

html - CSS 按钮不会在 div 中心对齐

javascript - HTML5 将常用属性组合成超属性?

javascript - jquery 获取文件宽度

css - <ul> 溢出-y : auto and <li>s with relative position behaves oddly

css - 带有多行标签的 Bootstrap 标签 - 如何使它们自下而上堆叠