我想为背景图像添加一个边距,以便我将它与屏幕中间距离,但是在该类中添加它会为整个身体添加边距.
body.poppage {
background: url(/Imagenes/tip3.png) 50% 200px no-repeat #E2E4E9;
}
Run Code Online (Sandbox Code Playgroud)
我怎么能这样做?谢谢
使用容器填充为背景留出某种余量。
<div class="thebox">
<p>HEY!</p>
</div>
div.thebox
{
box-sizing: border-box;
width:400px;
height:400px;
border: 2px solid #000000;
padding: 10px;
background: url(http://studio-creator.com/blog/public/html5.jpg) center;
background-size: contain;
background-repeat: no-repeat;
background-origin: content-box;
}
Run Code Online (Sandbox Code Playgroud)
https://jsfiddle.net/gann1pwm/
小智 5
这和我一起工作我有 50px 导航栏
background-size: contain !important;
background-repeat: no-repeat !important;
background-position: 0 50px !important;
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
45633 次 |
| 最近记录: |