我正在使用 960gs,并试图在不使用内部 div
的情况下向 div
添加填充。
你看,如果你给实际的 div
添加填充,它会破坏 960gs 创建的布局,我发现解决这个问题的唯一方法是创建另一个 div
并对其应用填充。
我猜这个方法没有问题,我只是发现第二个 div
是不必要的,我宁愿不使用它......有什么想法吗?
最佳答案
box-sizing 不起作用吗?
https://developer.mozilla.org/en-US/docs/Web/CSS/box-sizing
div {
width: 100px;
box-sizing: border-box;
}
border-box The width and height properties include the padding and border, but not the margin. This is the box model used by Internet Explorer when the document is in Quirks mode.
关于html - 如何在不使用 960gs 的内部 div 的情况下向 div 添加填充?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4312263/