我遇到了一个非常奇怪的问题。我有一个垂直菜单,其中css浮动左值,然后我得到一个表单。表单的第一行跳转到菜单的右侧。但是你可以在图片上看到其余的表格。我不知道为什么我得到这个,我试图解决它没有成功。
我在页面上使用bootstrap。
这是图片:
以下是完整的代码:
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap Example</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.2.0/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<style type="text/css">
.menu_settings{
width:200px;
float:left;
margin-left: 0px;
padding-left: 0px;
}
.li_settings{
height:100px;
}
</style>
</head>
<body>
<div class="container">
<div class="page-header">
<h1>My Page</h1>
</div>
<div class=" menu_settings">
<ul class="nav nav-pills nav-stacked">
<li class="active "><a href="#" class="li_settings">Home</a></li>
<li class="" ><a href="#" class="li_settings">Item 1</a></li>
<li class=""><a href="#" class="li_settings">Item 2</a></li>
<li class=""><a href="#" class="li_settings">Item 3</a></li>
</ul>
</div>
<div class="content_settings">
<form class="form-horizontal voffset4 fii" role="form">
<div class="form-group">
<label for="firstname" class="col-sm-2 control-label">First Name</label>
<div class="col-sm-5">
<input type="text" class="form-control" id="firstname" placeholder="Enter First Name">
</div>
</div>
<div class="form-group">
<label for="lastname" class="col-sm-2 control-label">Last Name</label>
<div class="col-sm-5">
<input type="text" class="form-control" id="lastname" placeholder="Enter Last Name">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2 " for="email">Email</label>
<div class="col-sm-4 ">
<input type="email" class="form-control" id="email" placeholder="Enter email">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="pwd">Password</label>
<div class="col-sm-4">
<input type="password" class="form-control" id="pwd" placeholder="Enter password">
</div>
</div>
<div class="form-group">
<div class=" col-sm-offset-2 col-sm-2 ">
<button type="submit" class="btn btn-default">Valider</button>
</div>
</div>
</form>
</div>
</div>
<div id="footer" class="voffset9">
<div class="container">
<p style="font-size: 16px;">Copyright 2015</p>
</div>
</div>
</body>
</html>
提前感谢您提供任何帮助;)