文章目录

  • 前言
  • 一、效果展示
    • 1.登录
    • 2.注册
  • 二、代码部分
    • 1.登录
    • 2.注册
  • 总结


前言

这一个简单的注册页面代码,适合初学者进行模仿和理解,这个代码仅限于两个页面的跳转,不包括数据处理

一、效果展示

1.登录

2.注册

二、代码部分

1.登录

代码如下(示例):

<style>
        * {
            padding: 0;
            margin: 0;
            box-sizing: border-box;
        }
        
        li {
            list-style: none;
        }
        
        a {
            text-decoration: none;
        }
        
        body {
            background-color: rgb(10, 158, 133);
        }
        
        .login {
            text-align: center;
            margin-top: 100px;
        }
        
        .login ul li input[type=text],
        .login ul li input[type=password] {
            font-size: 16px;
        }
        
        .login ul li input {
            width: 275px;
            height: 40px;
            margin-top: 20px;
        }
        
        .login ul li input[type=button] {
            width: 100px;
            height: 40px;
        }
    </style>
</head>

<body>
    <form class="login">
        <h2>登录</h2>
        <ul>
            <li>
                用户名:<input type="text">
            </li>
            <li>&emsp;码:<input type="password">
            </li>
            <li><input type="button" value="登录"></li>
            <li>还没有账号?<a href="注册.html">点击注册</a></li>
        </ul>
    </form>
</body>

2.注册

代码如下(示例):

 <style>
        * {
            padding: 0;
            margin: 0;
            box-sizing: border-box;
        }
        
        li {
            list-style: none;
        }
        
        a {
            text-decoration: none;
        }
        
        body {
            background-color: rgb(10, 158, 133);
        }
        
        .post {
            text-align: center;
            margin-top: 100px;
        }
        
        .post ul li input[type=text],
        .post ul li input[type=password],
        .post ul li input[type=email] {
            font-size: 16px;
        }
        
        .post ul li input {
            width: 275px;
            height: 40px;
            margin-top: 20px;
        }
        
        .post ul li input[type=submit] {
            width: 100px;
            height: 40px;
        }
    </style>
</head>

<body>
    <form class="post">
        <h2>注册</h2>
        <ul>
            <li>用户名:<input type="text"></li>
            <li>&emsp;码:<input type="password"></li>
            <li>&emsp;箱:<input type="email" required="required"></li>
            <li><input type="submit" value="注册"></li>
            <li>已有帐户?<a href="登录.html">点击登录</a></li>
        </ul>


    </form>
</body>

总结

登录和注册页面的写法相差不大,里面很多元素都是一样的。页面的样式也可以在style里面相对应的地方去修改(背景,大小等)。

更多推荐

一个简单的登录注册页面html代码