当前位置:Gxlcms > JavaScript > bootstrap怎么设置背景图片自适应

bootstrap怎么设置背景图片自适应

时间:2021-07-01 10:21:17 帮助过:227人阅读

推荐教程:Bootstrap教程

1、首先我们需要自定义一个css样式

  1. .bg {
  2. background:url(图片地址) no-repeat center;
  3. background-size:contain;
  4. }

2、在我们需要用到该样式的div中引用它

  1. <div class="row bg">

3、如果需要图片不随滚动条滚动,即固定不动则加fixd

  1. .bg {
  2. background:url(图片地址) no-repeat center fixed;
  3. background-size:contain;
  4. }

原文章地址:https://www.cnblogs.com/Hayley1666/p/8479491.html

以上就是bootstrap怎么设置背景图片自适应的详细内容,更多请关注Gxl网其它相关文章!

人气教程排行