使用HTML+CSS实现一个简单的登陆界面

这篇博客展示了如何使用HTML和CSS创建一个简单的登录界面。代码包括一个基本的HTML结构,定义了输入字段和提交按钮,并通过CSS进行样式设计,实现了背景颜色、布局居中、输入框样式等效果。此外,还包含了一个链接到注册页面的选项。
摘要由CSDN通过智能技术生成

登陆界面截图

 HTML代码

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="./login.css" type="text/css">
    <title>登陆界面</title>
</head>
<body>
    <div id="login">
        <form action="#" method="POST" id="form">
            <h2 id="login_title">Login</h2>
            <br />
            <input type="text" placeholder="请输入用户名" name="username" id="un" autocomplete="off">
            <br />
            <input type="password" placeholder="请输入密码" name="password" id="pd" autocomplete="off">
            <br />
            <br />

            <input type="submit" name="sub" value="登录" id="sub" autocomplete="off">
            <p id="more-link">
                <a href="#">返回首页</a>
                •
                <a href="#">用户注册</a>   <!-- 点击后跳转注册页面 -->
            </p>
        </form>

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

CSS代码

*{
    padding: 0;
    margin: 0;
}
body{
    background-color: rgb(123, 214, 241);
    /* 不想添加背景颜色可以更换为背景图片 */
    /* background: url("图片地址"); */
    opacity: 1.0;
}
#login{
    display: flex;
    width: 300px;
    height: 400px;
    background-color: white;
    /* opacity: 0.8; */
    text-align: center;
    margin:100px auto;
    justify-content: center;
}
#form{
    float: left;
}
#login_title{
    margin-top: 50px;
}

#un{
    width: 200px;
    height: 30px;
    border: none;
    border-bottom: solid 1px black;
    margin-top: 30px;
}
#un:focus{
    outline: none;   /* 去除username的input框点击输入时边框 */
}


#pd{
    width: 200px;
    height: 30px;
    border: none;
    border-bottom: solid 1px black;
    margin-top: 30px;
}
#pd:focus{
    /* border: red;         如果加上border颜色则输入时没有任何边框 */
    outline: none;      /* 去除passwod的input框点击输入时边框 */
}


#sub{
    width: 200px;
    height: 30px;
    margin-top: 30px;
    border: black solid 1px;
    border-radius:10px
}
#more-link{
    color: #467B96;
    margin-top: 20px;
}
#more-link a{
    background: transparent;
    text-decoration: none;
    color: #467B96;
    
}

界面

 欢迎一起交流探讨

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值