Home  >  Article  >  Web Front-end  >  How to set the background image in bootstrap to adapt to the screen size

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

尚
Original
2019-07-18 17:34:0913176browse

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;
}

Then quote it in your div This style will do:

<div class="row bg">

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;
}

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!

Statement:
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
Previous article:Why use bootstrapNext article:Why use bootstrap