要做一个边框用的是backgrounimage
然后怎么让他自适应,我写了高度才能把边框完整的显示出来,要是自适应的话又会有空白的高度,高度100%又没有用,求教下有什么好的方法
html
<div class="container">
<div class="row">
<div class="col-xs-12 col-sm-7">
<div class="new-bg">
<div class="cont">
<div class="stitle">校园新动向</div>
</div>
</div>
</div>
</div>
</div>
css
.new-bg{
background-image:url(img/538640d97b566.png);
background-size:100%;
background-repeat:no-repeat;
height:450px;
}
.cont{
padding-top:80px;
padding-left:150px;
}
.new-bg{
background-image:url(img/538640d97b566.png);
background-size: cover;
background-repeat: no-repeat;
height: 450px;
line-height: 450px;
text-align: center;
}
.cont{
/这里可以不用写/
}
你可以试试这个
<style>
.container{background-image:url(‘’) ;background-attachment:fixed;background-repeat:no-repeat;background-size:cover;-moz-background-size:cover;-webkit-background-size:cover;}
</style>
<body>
<div class=”container”>
</div>
</body>
在padding里使用百分比的长度就可以了吧