我正在运行 Bootstrap 2.3 和 Wordpress,我的目标是制作一个类似于此的巨型封面图片:http://www.platetheslate.com/ (只有我的导航栏在顶部。)下面是文章。
我试图通过我的头文件来实现它,在最顶部使用这样的代码:
<style>
.cut img {
max-width: 100%;
height: auto;
max-height: 100%;
}
</style>
<div class="cut">
<img src="">
</div>
但它并没有达到类似的效果,而且它在菜单栏和封面图片之间留下了相当大的差距。我对此有点陌生,但很想把它记下来。如果有更好的方法来解决这个问题或其他任何事情,我会洗耳恭听。或者眼睛。谢谢!
最佳答案
<html>
<head>
<style>
html {
background: url(your-image.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
</style>
</head>
<body>
</body>
</html>
你也可以尝试一个 jquery 解决方案: http://srobbin.com/jquery-plugins/backstretch/
关于jquery - Bootstrap 中的巨型封面照片(全宽、全高),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18935805/