Home >Web Front-end >Bootstrap Tutorial >How to set the background image to be adaptive in bootstrap

How to set the background image to be adaptive in bootstrap

angryTom
angryTomOriginal
2019-07-19 11:30:115480browse

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

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

<div class="row bg">

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

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!

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