css - 100% div(DIV 顶部有 10px 边距)

标签 css layout

伙计们,我正在使用这个 hack 来获得跨浏览器 100% 高度的 DIV

/* commented backslash hack \*/ 
html, body{height:100%;} 
/* end hack */
html,body {margin:0;padding:0}

#outer{min-height:100%;height:auto;background:#ffffcc}
* html #outer{height:100%;}/* ie6 and under*/

编辑:但是在我的 div 上我有一个 1px 的上边框和一个 10px 的上边距。此添加总计 16px。

知道如何编辑此 css 以说明 16px 吗?

最佳答案

将其嵌套在一个新的 div 中,该 div 将自动接管其父级的宽度。

关于css - 100% div(DIV 顶部有 10px 边距),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1770065/

相关文章:

javascript - 在保持宽高比的同时缩放 div 以填满屏幕

java - 图形未绘制/出现

css - 轮播不会填满 div

php - 如何在显示数据库中的动态数据时修复布局

javascript - 使用带自动完成功能的 YUI 布局

jquery - 将点元素放置在同一位置的圆形图像上

java - "ViewGroup"父控件,如果空间不足,则自动将控件移动到下一行

android - 如何让我的应用程序在华为 Mate 10 Pro 或其他 18 :9 ratio phones? 上全屏显示

android - Recyclerview加载数据后item-height变化

html - 将 margin 放入 Div