Blogger Information
Blog 36
fans 1
comment 0
visits 32384
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
Bootstrap水平表单登陆_2018年9月25日
宋超的博客
Original
672 people have browsed it

实例

<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="stylesheet" href="https://staff.bootcss.com/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css">
    <title>水平表单</title>
</head>
<body>
<div class="container">
    <div class="row">
        <div class="col-md-6 col-md-offset-3">
            <h3 class="text-center">用户登录:</h3>
            <!--水平表单:-->
            <form action="" class="form-horizontal">
                <div class="form-group">

                    <label for="" class="col-sm-2 control-label">邮箱:</label>
                    <div class="col-sm-10">
               <input type="email" id="email" class="form-control " placeholder="Email">
                    </div>

                </div>

                <div class="form-group">
                    <label for="" class="control-label col-sm-2">密码:</label>
                    <div class="col-sm-10">
                        <input type="password" class="form-control" placeholder="Password">
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-10 col-sm-offset-2">
                        <div class="checkbox">
                            <label>
                                <input type="checkbox" name="" id="" checked>记住密码
                            </label>
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-10 col-sm-offset-2">
                        <button class="btn btn-danger btn-block">登陆</button>
                    </div>
                </div>

            </form>
        </div>
    </div>
</div>

</body>
</html>

运行实例 »

点击 "运行实例" 按钮查看在线实例

总结:
1. form-horizontal 水平表单,下面的表单元素放在 <div class="form-group"></div的表单样式组内
2.label需要加上control-label样式,文本控件需要加 form-control
3.需要通过内嵌小栅格来让label和后面的元素同行显示,后面的元素也可通过栅格嵌套让其对齐上面元素.


Correction status:Uncorrected

Teacher's comments:
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post