我正在尝试使用css来填充我的表单/背景图像以占用整个屏幕,此时背景图像在底部被切除,表单没有完全占据屏幕上的所有空间相反,屏幕底部和顶部有空白区域。
以下是整个代码段。
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>SpaceMX</title>
<!-- CORE CSS-->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.1/css/materialize.min.css">
<style type="text/css">
html,
body {
height: 100%;
}
html {
display: table;
margin: auto;
height: 100%;
}
body {
display: table-cell;
height: 100%;
vertical-align: middle;
}
.margin {
margin: 0 !important;
}
form{
background: url('http://i.imgur.com/qhn5HDG.png');
width: 100%;
background-repeat:no-repeat;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
</style>
</head>
<body class="">
<form class="login-form">
<div class="row">
<div class="input-field col s12 center">
<p class="center login-form-text" class="responsive-img valign profile-image-login">SpaceMX</p>
</div>
</div>
<div class="row margin">
<div class="input-field col s12">
<i class="mdi-social-person-outline prefix"></i>
<input id="username" type="text" class="validate">
<label for="username" class="center-align">Username</label>
</div>
</div>
<div class="row margin">
<div class="input-field col s12">
<i class="mdi-communication-email prefix"></i>
<input id="email" type="email" class="validate">
<label for="email" class="center-align">Email</label>
</div>
</div>
<div class="row margin">
<div class="input-field col s12">
<i class="mdi-action-lock-outline prefix"></i>
<input id="password" type="password" class="validate">
<label for="password">Password</label>
</div>
</div>
<div class="row margin">
<div class="input-field col s12">
<i class="mdi-action-lock-outline prefix"></i>
<input id="password-again" type="password">
<label for="password-again">Re-type password</label>
</div>
</div>
<div class="row">
<div class="input-field col s12">
<a href="register.html" class="btn waves-effect waves-light col s12">Register Now</a>
</div>
<div class="input-field col s12">
<p class="margin center medium-small sign-up" color="white">Already have an account? <a href="login.html">Login</a></p>
</div>
</div>
</form>
<!-- ================================================
Scripts
================================================ -->
<!-- jQuery Library -->
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<!--materialize js-->
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.1/js/materialize.min.js"></script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-27820211-3', 'auto');
ga('send', 'pageview');
</body>
</html>
答案 0 :(得分:0)
从html标签中删除display:table并从css中的body标签中显示:table-cell。因为这个,身体居中在html标签中,这会在两侧产生空白。
答案 1 :(得分:0)
将css更改为:
html {
width: 100%;
height: 100%;
}
body {
width: 100%;
height: 100%;
}
form{
position absolute;
top: 0;
left: 0;
bottom:0;
right: 0;
overflow-y: auto;
background: url('http://i.imgur.com/qhn5HDG.png');
background-repeat:no-repeat;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
答案 2 :(得分:0)
浏览器有自己的默认填充和边距。所以你必须使它们等于零。
for i in range(df_full.size):
df_full[i] = df1[df_full.T == df1.T]
请告诉我这是否是你想要的。