我想要一個頁面高度爲50%的按鈕,但是當我添加style =「margin-top:50%;」時該按鈕被放置在頁面的底部....頁邊距不會正常工作
這裏是我的代碼:
html body {
background: url("images/backgroundmkb.jpg") no-repeat fixed;
background-size: 100% 100%;
}
<html lang="en">
<head>
<title></title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="http://cdn.jsdelivr.net/jquery.validation/1.15.1/jquery.validate.js">
</script>
</head>
<body style=" margin:0; padding:0;">
<div class="container" style="width:100%;">
<div class="row">
<div class="col-lg-12" style="margin-top:50%;">
<a href="startscherm">
<center>
<button class="btn btn-danger">Terug naar start</button>
</center>
</a>
</div>
</div>
</div>
</body>
</html>
這樣的作品,很好。但是當我說margin-top時,怎麼可能:50%按鈕放在底部? –