bootstrap做一个登录页面-FullStack

bootstrap做一个登录框

Table of Contents

背景

效果图

​1.步骤

2.知识点

3.修改body部分,代码如下


背景

bootstrap做了一个登录页面,因为这个页面经常会用到,所以写个blog做个备份


效果图

在这里插入图片描述


1.步骤

    引入bootstrap,官网:https://getbootstrap.com/ ,get start,直接copy模板

在这里插入图片描述


2.知识点

    引用icon,首先登录 这个https://fontawesome.com/ ,注册会有邮件发你告诉你引用密码
    搜索想用的icon,复制到代码中 eg:

    需要form组件 https://getbootstrap.com/docs/4.3/components/forms/
    拿过来改改

    细节
    text-right 文字靠右
    px-2={padding-right: 0.5rem !important;margin-left: 0.5rem !important}
    py-2={padding-top: 0.5rem !important;margin-bottom: 0.5rem !important}

3.修改body部分,代码如下

            <div class="col-md-4 offset-md-4">
                <form class=" border border-muted">
                    <div class="bg-light" style="width:100%;">
                      <div class="title">
                        <h3>Sign In</h3>
                      </div>
                      <div class="text-right">
                          <i class="fab fa-facebook-square"></i>
                          <i class="fab fa-github"></i>
                          <i class="fab fa-google-plus-square"></i>

                      </div>
                    </div>
                    <div class="input-group mb-3 mt-3 px-3">
                        <div class="input-group-prepend">
                          <span class="input-group-text" id="basic-addon1">
                              <i class="fas fa-user-circle"></i>
                          </span>
                        </div>
                        <input type="text" class="form-control" placeholder="Username" aria-label="Username" aria-describedby="basic-addon1">
                    </div>
                    <div class="input-group mb-3 px-3">
                        <div class="input-group-prepend">
                          <span class="input-group-text" id="basic-addon1">
                              <i class="fas fa-key"></i>
                          </span>
                        </div>
                        <input type="text" class="form-control" placeholder="Username" aria-label="Username" aria-describedby="basic-addon1">
                    </div>
                    <div class="form-group">
                      <div class="form-check">
                        <input type="checkbox" class="form-check-input" id="dropdownCheck">
                        <label class="form-check-label" for="dropdownCheck">
                          Remember me
                        </label>
                      </div>
                    </div>
                    <div class="text-right"><a >Login</a></div>
                    <div class="bg-light mt-2 text-center">
                      <a class="dropdown-item" href="#">New around here? <span class="text-primary">Sign up</span></a>
                      <a class="dropdown-item text-primary" href="#">Forgot password?</a>
                    </div>
                </form>
            </div>

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
好的,下面是一个简单的登录界面和注册界面的代码示例,采用了Bootstrap框架和HTML/CSS编写。 登录界面代码: ```html <!DOCTYPE html> <html> <head> <title>Login</title> <!-- 引入Bootstrap样式文件 --> <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/css/bootstrap.min.css"> <!-- 自定义样式 --> <style> body { background-color: #f5f5f5; } .container { margin-top: 100px; max-width: 400px; padding: 20px; background-color: #fff; box-shadow: 0px 0px 10px 0px #ccc; border-radius: 5px; } h2 { text-align: center; margin-bottom: 20px; } </style> </head> <body> <div class="container"> <h2>Login</h2> <form> <div class="form-group"> <label for="username">Username</label> <input type="text" class="form-control" id="username" placeholder="Enter username"> </div> <div class="form-group"> <label for="password">Password</label> <input type="password" class="form-control" id="password" placeholder="Password"> </div> <button type="submit" class="btn btn-primary btn-block">Submit</button> </form> </div> <!-- 引入jQuery和Bootstrap JavaScript文件 --> <script src="https://cdn.staticfile.org/jquery/3.2.1/jquery.min.js"></script> <script src="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/js/bootstrap.min.js"></script> </body> </html> ``` 注册界面代码: ```html <!DOCTYPE html> <html> <head> <title>Register</title> <!-- 引入Bootstrap样式文件 --> <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/css/bootstrap.min.css"> <!-- 自定义样式 --> <style> body { background-color: #f5f5f5; } .container { margin-top: 100px; max-width: 400px; padding: 20px; background-color: #fff; box-shadow: 0px 0px 10px 0px #ccc; border-radius: 5px; } h2 { text-align: center; margin-bottom: 20px; } </style> </head> <body> <div class="container"> <h2>Register</h2> <form> <div class="form-group"> <label for="username">Username</label> <input type="text" class="form-control" id="username" placeholder="Enter username"> </div> <div class="form-group"> <label for="email">Email</label> <input type="email" class="form-control" id="email" placeholder="Enter email"> </div> <div class="form-group"> <label for="password">Password</label> <input type="password" class="form-control" id="password" placeholder="Password"> </div> <div class="form-group"> <label for="confirm-password">Confirm Password</label> <input type="password" class="form-control" id="confirm-password" placeholder="Confirm password"> </div> <button type="submit" class="btn btn-primary btn-block">Submit</button> </form> </div> <!-- 引入jQuery和Bootstrap JavaScript文件 --> <script src="https://cdn.staticfile.org/jquery/3.2.1/jquery.min.js"></script> <script src="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/js/bootstrap.min.js"></script> </body> </html> ``` 你可以将以上代码复制到一个HTML文件中,然后在浏览器中打开该文件,即可看到登录界面和注册界面。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值