块级div设置行宽,居中显示

<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8"> 
	<title>登录</title>
	<link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">  
	<script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
	<script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body >

<div class="page-header text-center">
  <h1>摄影
    <small>展会</small>
  </h1>
</div>
<!--居中设置 margin:0 auto;-->
<!--块级设置行宽 width:300px;--> <div style="background:green;margin:0 auto;width:300px;"> <form role="form" > <table class="table" style="width:400px"> <tbody > <tr> <div class="form-group"> <td> <label for="name">名称</label> </td> <td> <input type="text" class="form-control" id="name" placeholder="请输入名称" style="width:200px"> </td> </div> </tr> <tr> <div class="form-group"> <td> <label for="name">密码</label> </td> <td> <input type="password" class="form-control" id="name" placeholder="请输入密码" style="width:200px"> </td> </div> </tr> <tr> <td> <button type="submit" class="btn btn-default">提交</button> </td> <td> <button type="submit" class="btn btn-default">注册</button> </td> </tr> </tbody> </table> </form> </div> </body> </html>

猜你喜欢

转载自www.cnblogs.com/xhk123/p/11598713.html
今日推荐