【发布时间】:2016-01-31 23:18:28
【问题描述】:
我想让 div 的背景图像具有响应性。我使用了 bootstrap 3.3 我为背景图像编写了自己的 CSS。我的代码如下。
.search-row-wrapper
{
background:url(../../Images/frontend/MassageBanner.jpg );
background-size: cover;
height:400px;
padding:50px 0;
transition:all 400ms cubic-bezier(0.25,0.1,0.25,1) 0s;
-webkit-transition:all 400ms cubic-bezier(0.25,0.1,0.25,1) 0s;width:100%;
}
【问题讨论】:
-
你的代码没问题,你的意思是让图片适应所有尺寸的div的尺寸吗?
-
是的,我想将 div 的背景图像调整为所有尺寸,例如(移动设备、平板电脑或台式机)
-
尝试在其中添加
background-position: center;。 -
是的,(背景位置:中心;)它有效。谢谢@Claudiordgz
标签: css twitter-bootstrap