1.bootstrap中文官网
2.步骤
2.1复制基本模板代码
https://v3.bootcss.com/getting-started/#template
2.2复制页头代码
https://v3.bootcss.com/components/#page-header
2.3创建中间登录框部分div和底部div
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>登录界面 </title> <!-- Bootstrap --> <link href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" rel="stylesheet"> </head> <body> <!-- 标题 --> <div class="page-header"> <h1>XXXX信息系统登录界面</h1> </div> <!-- 中间登录框 --> <div class="container-fluid"> <div class="row"> </div> </div> <!-- 页脚 --> <div class="footer"> <p>©版权所有:XXXXX学院XX市XX大道XXX号</p> <p>邮编:530001联系邮箱:xxxxxxx@163.com</p> </div> </div> <!-- jQuery (Bootstrap 的所有 JavaScript 插件都依赖 jQuery,所以必须放在前边) --> <script src="https://cdn.jsdelivr.net/npm/jquery@1.12.4/dist/jquery.min.js"></script> <!-- 加载 Bootstrap 的所有 JavaScript 插件。你也可以根据需要只加载单个插件。 --> <script src="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/js/bootstrap.min.js"></script> </body> </html>
2.4复制水平排列表单到中间登录框部分div
https://v3.bootcss.com/css/#forms-horizontal
2.5 调整样式(一个Html标签可以应用多个类样式,中间用空格隔开)
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>登录界面 </title> <!-- Bootstrap --> <script src="js/jquery-3.4.1.js"></script> <link href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" rel="stylesheet"> <style> .bg{ height: 600px; background-image:url(/images/bg.jpg); background-size:cover; } .form{ padding: 40px; margin-top: 175px; background: rgba(255,255,255,0.2); } .footer{ height: 60px; padding-top:20px; font-size: 14px; font-weight: bold; text-align: center; } </style> </head> <body> <div class="page-header"> <h1>XXXX信息系统登录界面</h1> </div> <div class="container-fluid"> <div class="row bg"> <div class="col-md-offset-6 col-md-4 col-sm-offset-3 col-sm-7 col-xs-offset-2 col-xs-8 col-lg-offset-6 col-lg-3 form"> <form class="form-horizontal" id="loginForm"> <div class="form-group"> <label for="username" class="col-sm-4 control-label">用户名</label> <div class="col-sm-8"> <input type="text" class="form-control" id="username" placeholder="请输入用户名"> </div> </div> <div class="form-group"> <label for="password" class="col-sm-4 control-label">密码</label> <div class="col-sm-8"> <input type="password" class="form-control" id="password" placeholder="请输入密码"> </div> </div> <div class="form-group"> <label for="validateCode" class="col-sm-4 control-label">验证码</label> <div class="col-sm-4"> <input type="text" class="form-control" id="validateCode" placeholder="请输入验证码" > </div> <div class="col-sm-4"> <img src="images/yzm.jpg" alt="" width="75px" height="35px"> </div> </div> <div class="form-group"> <div class="col-sm-offset-2 col-sm-10"> <div class="checkbox"> <label> <input type="checkbox">记住我 </label> </div> </div> </div> <div class="form-group"> <div class="col-sm-offset-2 col-sm-10"> <button type="button" id="submitBtn" class="btn btn-success" style=" 50%;">登录</button> </div> </div> </form> <span style="color: red;" id="tip"></span> </div> </div> <div class="footer"> <p>©版权所有:XXXXX学院XX市XX大道XXX号</p> <p>邮编:530001联系邮箱:xxxxxxx@163.com</p> </div> </div> <!-- jQuery (Bootstrap 的所有 JavaScript 插件都依赖 jQuery,所以必须放在前边) --> <script src="https://cdn.jsdelivr.net/npm/jquery@1.12.4/dist/jquery.min.js"></script> <!-- 加载 Bootstrap 的所有 JavaScript 插件。你也可以根据需要只加载单个插件。 --> <script src="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/js/bootstrap.min.js"></script> </body> </html>
3.运行效果图(一个简陋的登录界面)