Home > Article > Web Front-end > 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!