[英]How to make a landing page with a full screen image?
我想制作一个全屏图像的登录页面。 像这样: http : //startbootstrap.com/templates/stylish-portfolio/
我可以找出它下面的其余内容,但是如何使图像覆盖整个屏幕呢?
它是标题标签的背景
如果您转到fashion_portfolio.css中的第153至163行
.header {
display: table;
position: relative;
width: 100%;
height: 100%;
background: url(../img/bg.jpg) no-repeat center center scroll;
-webkit-background-size: cover;
-moz-background-size: cover;
background-size: cover;
-o-background-size: cover;}
backgorund-size是使之覆盖所有屏幕W3C的技巧
- -编辑
高度和宽度应为100%,以使图片适合所有媒体上的整个屏幕。
您应该拍摄大尺寸的图像。 然后
你的HTML看起来像
<html>
<head>
<title>Landing Page</title>
</head>
<body>
<div class="landingbg"> </div>
</body>
</html>
然后CSS将是
.landingbg{
background: url("img/bg.jpg") no-repeat scroll center center / cover rgba(0, 0, 0, 0);
display: block;
height: 100%;
position: relative;
width: 100%;
}
试试这个,告诉我是否有问题
您可能需要大的高清图像作为背景。
html {
background: url(images/bg.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
有关更多详细信息: http : //css-tricks.com/perfect-full-page-background-image/
具有JQuery功能以获取最终用户屏幕的宽度和高度。
var jQueryWidth = $( window ).width();
var jQueryHeight = $( window ).height();
完成此操作后,设置HTML图像的width和height属性。
<img src="yourImage.jpg" alt="Alternate text" height="<jQueryWidth>" width="<jQueryHeight>">
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.