html - 有色背景图像不适用于 Bootstrap
问题描述
我在我的身体背景图像中添加了一个黑色透明渐变,但是当我将引导程序添加到 html 文件时,它停止工作。
body {
background:
linear-gradient(
rgba(0, 0, 0, 0.5),
rgba(0, 0, 0, 0.5)
),
url("https://picsum.photos/id/1000/800/800");
background-size: cover;
}
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
解决方案
按照此链接中给出的示例-> https://mdbootstrap.com/docs/jquery/css/background-image/
HTML
<body>
<div class="bg"></div>
<p class="py-5 text-center">This example creates a full page background image. Try to resize the browser window to see how it always will cover the full screen (when scrolled to top), and that it scales nicely on all screen sizes.</p>
CSS
body, html {
height: 100%;
}
.bg {
/* The image used */
background-image: url("https://mdbootstrap.com/img/Photos/Horizontal/Nature/full page/img(20).jpg");
/* Full height */
height: 100%;
/* Center and scale the image nicely */
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
推荐阅读
- apache-nifi - 从 Ni-Fi 处理器获取 Kylo Feed ID
- laravel - Laravel:如何确保用户在注册和登录后进入角色特定的主页视图?
- elasticsearch - 如何使用 Elastic Java API 6.5.1 仅使用原始查询 JSON 进行搜索?
- sql - 仅获取一个日期值最早的结果
- python - 迭代行时数据框值不更新
- php - 如何检查php多维数组是否有键(索引)
- vue.js - 在 v-treeview 中删除项目的最佳方法?
- apache-flink - 为什么 flink 不丢弃迟到的数据?
- python - Pandas date_range() 用于月中和月末
- kubernetes - 如何在运行的抢占式实例中保存 SQL 存储数据?