Html 不带滚动条的可调整大小的背景图像
我试图使一个静态页面,你将永远无法滚动时,全屏。我只希望我的表单居中,背景图像随着窗口的大小而改变。我是一个初学者,如果这真的很明显,我很抱歉Html 不带滚动条的可调整大小的背景图像,html,css,image,scroll,background,Html,Css,Image,Scroll,Background,我试图使一个静态页面,你将永远无法滚动时,全屏。我只希望我的表单居中,背景图像随着窗口的大小而改变。我是一个初学者,如果这真的很明显,我很抱歉 .container{ 显示器:flex; 证明内容:中心; /*水平居中*/ 对齐项目:居中; /*垂直居中*/ } .trans{ 背景:rgba(1,1,1,0.6); } 身体{ 身高:100%; } .身高{ 身高:100% } html{ 身高:100%; 背景:url(wallpar.jpg)无重复中心固定; -webkit背景尺寸:封面
.container{
显示器:flex;
证明内容:中心;
/*水平居中*/
对齐项目:居中;
/*垂直居中*/
}
.trans{
背景:rgba(1,1,1,0.6);
}
身体{
身高:100%;
}
.身高{
身高:100%
}
html{
身高:100%;
背景:url(wallpar.jpg)无重复中心固定;
-webkit背景尺寸:封面;
-moz背景尺寸:封面;
-o-背景尺寸:封面;
背景尺寸:封面;
}
提交
此规则
html {
height: 100%;
background: url(wallpaper.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
必须应用于主体
标记:
body {
height: 100%;
background: url(wallpaper.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
这条规则
html {
height: 100%;
background: url(wallpaper.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
必须应用于主体
标记:
body {
height: 100%;
background: url(wallpaper.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
你的CSS是对的
始终通过重置一些CSS属性开始创建网站:
* {
margin: 0px;
padding: 0px;
max-width: 100%;
box-sizing: border-box;
-webkit-font-smoothing: subpixel-antialiased;
}
或使用
为什么??
因为每个浏览器都提供自己的默认CSS,所以我们需要添加自己的CSS
这将在将来对您有很大帮助:)您的CSS是正确的
始终通过重置一些CSS属性开始创建网站:
* {
margin: 0px;
padding: 0px;
max-width: 100%;
box-sizing: border-box;
-webkit-font-smoothing: subpixel-antialiased;
}
或使用
为什么??
因为每个浏览器都提供自己的默认CSS,所以我们需要添加自己的CSS
这将在将来对您有很大帮助:)不要忘记重置正文的默认边距不要忘记重置正文的默认边距