这是我的代码,HTML 和 body 有 body 类,然后在它们里面有一个 div 有一个背景图像,里面有一个 div 有颜色覆盖,最后在它们里面有一个登录表单。我在我的页面中滚动,如何删除它并拥有一个不滚动的页面。对我来说,所有媒体尺寸都是正确的很重要。
.bg-image{
background: url("../images/666664.jpg") ;
height: 100%;
position: relative;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
.body{
height: 100%;
margin: 0;
font: 400 15px/1.8 "Lato", sans-serif;
color: white!important;
}
.color-overlay {
position: relative;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: #0d235b;
opacity: 0.6;
}
<html class="body">
<head>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
</head>
<body class="body">
<div class="bg-image">
<div class="color-overlay"></div>
<div class="container">
<div class="row">
<form class="login form_height col-xs-12 ">
<div class="form-group row">
<label for="staticEmail" class="col-sm-3 col-form-label">Username</label>
<div class="col-sm-9">
<input placeholder="Username" type="text" class="form-control" id="staticEmail">
</div>
</div>
<div class="form-group row">
<label for="inputPassword" class="col-sm-3 col-form-label">Password</label>
<div class="col-sm-9">
<input type="password" class="form-control" id="inputPassword" placeholder="Password">
</div>
</div>
<div class="form-group row">
<label for="sub_btn" class="col-sm-3 col-form-label" ></label>
<div class="col-sm-9">
<input type="submit" class="btn login_btn btn-default btn_sub " value="Login" id="sub_btn" >
</div>
</div>
</form>
</div>
</div>
</div>
<footer class="col-xs-12 no-padd"></footer>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
</body>
</html>
最佳答案
您需要放置<div class="container">...</div>
里面<div class="color-overlay"></div>
- 这一定能解决您的问题。
关于html - html网页上的滚动问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52913531/