bootstrop設置背景圖片自適應屏幕
阿新 • • 發佈:2018-06-16
span ack ont login TE con eight PE class
如果不用bootstrop框架,想讓背景圖片自適應窗口大小,可以這樣做:
<style type="text/css"> html{height: 100%;} body.aa{height: auto; background: url(login-background.png) no-repeat center fixed; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover; color: rgba(255, 255, 255, .95)} </style>
bootstrop中
css中編輯此樣式:
.bg { background:url(圖片地址) no-repeat center; background-size:contain; }
然後在你的div裏引用這個樣式就行了:
<div class="row bg">
使圖片不隨滾動條滾動,即固定不動則加fixd:
.bg { background:url(圖片地址) no-repeat center fixed; background-size:contain; }
bootstrop設置背景圖片自適應屏幕