html - CSS:在不影响背景填充的情况下调整正文填充?

标签 html css

目前我有:

body
{
    background-image:url('images/background');
    background-color:#000;
    background-position:center; 
    background-repeat:repeat-y;
    padding-right: 75px;
    padding-left: 75px; 
} 

如何让背景更像这样:

body
{
    background-image:url('images/background');
    background-color:#000;
    background-position:center; 
    background-repeat:repeat-y;
} 

除了背景之外, body 内的东西仍然有填充?

基本上,我希望背景不受填充设置的影响,这与正文中设置的文本、图像等不同。

最佳答案

稍微重新安排一下,这样您体内就有了一个新的顶级容器,这样...

<body ...background goes here ...>
  <div id="therealbody" ... padding goes here ...> ... content here ... </div>
</body>

关于html - CSS:在不影响背景填充的情况下调整正文填充?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12805875/

相关文章:

javascript - Jquery 数据表 : Replacing the buttons with icons at the same location

html - 如何通过 scss 文件在 ionic 3 中应用自定义 css 规则

jquery - 在 jquery + css 中的图像悬停中添加颜色色调

html - 推特 Bootstrap : proper way of aligning checkbox with checkbox label

html - 手动调整 chrome viewport 的大小与使用 "Inspect"在浏览器中调整大小有不同的结果

javascript - 将 json 结果添加到表单操作 url

javascript - 简单的节点与 polymer 的结合

html - Bootstrap 4 上的水平和垂直居中卡

asp.net - 我想在 div 中使用 li 标签,但不推荐这样做,还有其他方法吗?

html - Jekyll,Markdown 不以正常方式(从上到下)呈现内容,而是全部向右