How to set the background image in bootstrap to adapt to the screen size

Release: 2019-07-18 17:34:09
Original
13189 people have browsed it

How to set the background image in bootstrap to adapt to the screen size

bootstrap sets the background image to adapt to the screen size:

Edit this style in css:

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

Then quote it in your div This style will do:

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

If the image does not scroll with the scroll bar, that is, if it is fixed, add fixd. The css code is as follows:

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

For more technical articles related to Bootstrap, please visit Bootstrap Tutorial column to learn!

The above is the detailed content of How to set the background image in bootstrap to adapt to the screen size. 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