我想知道你是否可以在 body 标签上加上宽度?
例如:
body {
background: url(bg.png);
width: 1200px;
}
那是糟糕的 css,它会导致问题吗?我只是想知道以供将来引用
最佳答案
绝对最好在 body 内使用 div。它更加灵活,并且更有意义。
参见下面的示例,您可以实现与 div 相同的效果。
<body>
<div style="width:100%; height: 100%">
<div style="background: url(bg.png); width: 1200px;">
Does the same thing as the other thing, but is way more flexible.
</div>
</div>
</body>
关于css - 设置静态主体宽度是个好主意吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11364593/