我正在使用此代码将固定宽度图像居中/定位为背景.我需要在填充浏览器窗口边距的图像周围添加颜色.我试过背景色,边框颜色......
因此,图像的宽度为1050像素.如果浏览器窗口是1500px,我想让剩余区域变黑(例如).我怎样才能做到这一点?
#content {
text-align: left;
width: 1050px;
height: 825px;
margin: 0 auto;
padding: 0px;
background-image: url(file:///X|/CarFingers/tabback1_hor.png);
background-repeat: no-repeat;
}
body {
font-family: Helvetica, Arial, sans-serif;
font-size: 14px;
color: #333333;
text-align: center;
}
Run Code Online (Sandbox Code Playgroud)
<div id="content">
<body>
</body>
</div>
Run Code Online (Sandbox Code Playgroud)
第一:把divINSIDE你的body.然后你可以像这样编辑你的身体背景:
body{
background-color: black;
}
Run Code Online (Sandbox Code Playgroud)