css - 响应图像背景

标签 css image twitter-bootstrap background

我有一张图片作为我的背景,但我不知道如何让我的代码响应,以便在我缩小浏览器窗口时图像保持一致。这是我的代码:

body {
margin-top: 50px; 
}


.full {
background: url(../melissa.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
background-size: cover;
-o-background-size: cover;
}

最佳答案

如果你想要响应式背景,请看这个SAMPLE

.full {
    height: 500px;
    background-image: url('image.jpg');
    background-position: center top;
    background-repeat: no-repeat;
    background-size: cover;
}

关于css - 响应图像背景,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30158449/

相关文章:

html - 悬停时显示图像,在背景中居中

javascript - 在溢出时创建一个新的 div 并将溢出文本传输到新的 div

CSS将垂直滚动条显示到div中

html - z-index IE7, IE8, IE9 不起作用?

html - css float 不显示右侧的 div

css - 使用 CSS 实现图像查看器

java - 无法从图库 Android 应用程序中选择图像(灰显)

php - 快速以肖像模式拍摄照片并上传到服务器 - 上传的图像显示方向错误

jquery - Bootstrap 3 Carousel 带缩略图(图像和文本)

javascript - Bootstrap Modal - 使用 Javascript 将数据传递到 Modal