html - 如何给引导列背景图像?
问题描述
我只是想知道如何在引导程序中为 col 提供背景图像,因此它只会出现在该列中而不是整个页面中。我正在尝试这样做,这样我就可以让我的导航栏保持透明,并且只有它下面的列有背景图案。
解决方案
首先,您需要给 col 一个类名或 id,例如
<div class="col-xs-3 myImage">
您可以使用下面的示例将图像放置在容器本身中。在您的 css 中,您首先需要确保图像包含在列中,因此设置 max-width 参数。
.myImage{
display:block;
max-width:100%; // change this is you need it to be smaller
background-image:url('yourimagefoldername/imagefilename.jpg');
background-size: cover; // contain might suite you better
background-position:center; // this can be change to top, bottom or wherever
}
这几乎就是您需要做的所有事情。
推荐阅读
- mysql - 如何在没有端口冲突的情况下将 mysql 端口从主机绑定到 docker 容器
- javascript - 如何在 JavaScript 中创建一个全新的关键字?
- java - 尝试在 Android 中打开新屏幕/活动
- php - nginx 将 index.html 的 swagger UI 路径视为路由路径
- javascript - MongoDB Stitch - 如何在更新减少时将数据类型保持为 int?
- r - 将函数视为数据(如将函数与数据集捆绑) - 最佳方法
- android - Gradle 同步失败:无法 HEAD 'jcenter.bintray.com/org/jetbrains/kotlin/kotlin-stdlib-jdk8/...'。从服务器收到状态码 403:Forbidden
- python - 有没有办法用python从3d模型二进制文件中提取子模型
- r - 仅为变量的特定值创建直方图
- android - 警报不会从设备存储中响起 android?