1. 程式人生 > >bootstrap表單的基本操作

bootstrap表單的基本操作

<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
    <title>bootstrap表單的基本操作</title>
    <link rel="stylesheet" href="css/bootstrap.min.css">
    <script src="js/jquery-3.3.1.min.js"></script>  
    <script src="js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
    <div class="row">
        <div class="col-md-12">
            <form action="" role="form">
                <fieldset>
                    <legend>使用者登陸</legend>
                    <div class="form-group">
                        <label for="name">使用者名稱登陸:</label>
                        <input type="text" class="form-control" id="name" placeholder="UserName">
                        <p class="help-block">可以用手機號和郵箱登陸</p>
                    </div>
                    <div class="form-group">
                        <label for="password">密碼:</label>
                        <input type="text" class="form-control" id="password" placeholder="PassWord">
                        <p class="help-block">密碼不得少於6位</p>
                    </div>
                </fieldset>
                <button type="submit" name="button" class="btn btn-info btn-block">提交</button>
            </form>
        </div>
    </div>
</div>
</body>
</html>



其他的請參考:https://v3.bootcss.com/css/#forms

<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
    <title>bootstrap表單自適用設計</title>
    <link rel="stylesheet" href="css/bootstrap.min.css">
    <script src="js/jquery-3.3.1.min.js"></script>  
    <script src="js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">

            <form action="" role="form" class="form-horizontal">
                <fieldset>
                    <legend class="text-center">使用者登陸</legend>
                    <div class="form-group">
                        <label for="name" class="col-md-2 control-label">使用者名稱登陸:</label>
                        <div class="col-md-10">
                            <input type="text" class="form-control" id="name" placeholder="UserName">
                        </div>   
                    </div>
                    <div class="form-group">
                        <label for="password" class="col-md-2 control-label">密碼:</label>
                        <div class="col-md-10">
                            <input type="text" class="form-control" id="password" placeholder="PassWord">
                        </div>
                        
                        
                    </div>                    
                </fieldset>
                <div class="form-group">
                    <div class="col-md-offset-2 col-md-10">
                       <button type="submit" name="button" class="btn btn-info">提交</button> 
                    </div>
                    
                </div>
            </form>


</div>
</body>
</html>