【问题标题】:How to make a background image in twitter bootstrap around a container如何在容器周围的 twitter 引导程序中制作背景图像
【发布时间】:2015-09-23 19:14:50
【问题描述】:
我有一个非常标准的引导布局,页面下方有一个固定大小的容器。但是,我想知道是否有某种方法可以装饰容器左侧和右侧的区域以使其看起来不那么平淡,例如使用背景图像/颜色/css样式等。我知道重点容器是为了允许响应式设计,但有没有办法可以进行这种自定义,或者它是否违背了首先拥有容器的观点?
【问题讨论】:
标签:
html
css
twitter-bootstrap
background
containers
【解决方案1】:
只需将背景颜色/图像/等应用到body 标签,如下所示:
body {
background-image:url(someImage.jpg);
/* other css properties */
}
以上内容只会影响包装页面元素的容器 div 之外的区域。
【解决方案2】:
为正文添加背景图片
body{
background: #color url(image.jpg/png) no-repeat left top; /* non repeating background */
/* background: #color url(image.jpg/png) repeat-x left top; repeating the background in a vertical direction */
}
如果您使用图片,我还建议您仔细选择图片以适合您的页面宽度。您也可以从 url 中删除...仅使用颜色