How to set the background image to be adaptive in bootstrap

angryTom
Release: 2019-07-19 11:30:32
Original
5459 people have browsed it

How to set the background image to be adaptive in bootstrap

Recommended tutorial: Bootstrap tutorial

1. First we need to Define a css style

.bg {
       background:url(图片地址) no-repeat center;
       background-size:contain;
}
Copy after login

2. Reference it in the div where we need to use the style

<div class="row bg">
Copy after login

3. If you need the picture not to scroll with the scroll bar, that is, to be fixed, add fixd

.bg {
       background:url(图片地址) no-repeat center fixed;
       background-size:contain;
}
Copy after login

Original article address: https://www.cnblogs.com/Hayley1666/p/8479491. html

The above is the detailed content of How to set the background image to be adaptive in bootstrap. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template