html网页制作之简单登入界面

本文详细介绍了如何使用HTML和CSS创建一个包含用户名、密码、用户类型、性别选择、兴趣爱好、出生日期和邮箱的注册表单,以及模拟注册和重置功能的实现。
摘要由CSDN通过智能技术生成

效果图展示

功能介绍

  1. 输入注册信息
  2. 选择用户类型
  3. 设置单选框和复选框
  4. 选择出生日期
  5. 输入电子邮箱
  6. 书写自我介绍
  7. 点击注册(设置了事件触发进行模拟注册)
  8. 重置信息

 

html 代码

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>简单登入界面</title>
    <link rel="stylesheet" href="./css/style.css">
</head>
<body>
    <div class="wrap">
        <div class="text_h">
            <h1>REGISTER</h1>
        </div>
        <!-- <table>是<tr>的上层标签 <tr>必须在一个<table></table>里面,
        它不能单独使用,相当于<table>的属性标签.  <table>标示一个表
        格,<tr>标示这个表格中间的一个行  <td>标示行中的一个列,
        需要嵌套在<tr></tr>中间 -->
        <form>
            <table>
                <tr>
                    <td class="tips">用户账号:</td>
                    <td>
                        <input type="text" class="textarea" placeholder="请输入账号">
                    </td>
                </tr>
                <tr>
                    <td class="tips">用户密码:</td>
                    <td>
                        <input type="password" class="textarea" minlength="6" placeholder="请输入密码(不少于6位)">
                    </td>
                </tr>
                <tr>
                    <td class="tips">确认密码:</td>
                    <td>
                        <input type="password" class="textarea" placeholder="请再次确认密码">
                    </td>
                </tr>
                <tr>
                    <td class="tips">用户类型:</td>
                    <td>
                        <select>
                            <option>企业用户</option>
                            <option>普通用户</option>
                            <option>游客</option>
                        </select>
                    </td>
                </tr>
                <tr>
                    <td class="tips">用户性别: &nbsp;</td>
                    <td class="text1">
                        <input type="radio" name="sex">男
                        <input type="radio" name="sex">女
                    </td>
                </tr>
                <tr>
                    <td class="tips">兴趣爱好: &nbsp;</td>
                    <td class="text1"> 
                        <input type="checkbox">游泳
                        <input type="checkbox">滑冰
                        <input type="checkbox">绘画
                    </td>
                </tr>
                <tr>
                    <td class="tips">出生日期: &nbsp;</td>
                    <td> 
                        <input type="date" class="text2">
                    </td>
                </tr>
                <tr>
                    <td class="tips">电子邮箱: </td>
                    <td> 
                        <input type="email" class="textarea" required>
                        <!-- require不允许为空 -->
                    </td>
                </tr>
                <tr>
                    <td class="tips">自我介绍: </td>
                    <td> 
                        <textarea class="text_p"></textarea>
                        <!-- 自动换行 -->
                        
                    </td>
                </tr>
            </table>
            <div class="anniu">
                <button type="submit" class="button" onclick="test_zc(1)">注册</button>
                <button type="reset" class="button">重置</button>
                <!-- 重置按钮要在form中实现 -->
            </div>
        </form>
    </div>

    <script>
        function test_zc(a){
            alert("注册成功");
        }
        
    </script>

</body>
</html>

css样式

/* 初始化 */
*{
    margin: 0px;
    padding: 0px;
    font-family: "KaiTi",楷体;
}

body{
    height: 100vh;
    width: 100%;
    background-image: url(../images/3.jpg);
    background-size: 100% 100%;
    overflow: hidden;
}

.wrap{
    position: fixed;
    /* 弹性布局 */
    top: 50%;
    left: 50%;
    width: 480px;
    height: 700px;
    background-color: rgba(255, 255, 255, 0.3);
	border-radius: 30px;
	transform: translate(-50%, -50%);
    /* ranslate() 这个 CSS 函数在水平和/或垂直方向上重新定位元素 */
    padding: 20px;
}

.text_h{
    /* border: 1px solid #000; */
    height: 50px;
    width: 200px;
    margin: auto;
}

h1{
    font-size: 3em;
}

table{
    color: #fff;
    /* width: 100%; */
    margin: 30px;
    padding: 10px 20px ;
    /* border-spacing: 15px 10px; */
    /* 水平间距 垂直间距 */
}



tr{
	height: 38px;
	line-height: 38px;
}

.tips{
    font-size: 1.5em;
}

/* .titles{
	text-align: right;
} */

/* input{
	background: none;
	border: 1px solid #fff;
	border-radius: 15px;
}  */

.textarea{
    
    height: 30px;
    width: 200px;
	background: none;
    /* 取消输入框背景色 */
	border: 1px solid #fff;
	border-radius: 13px;
    padding: 1px 15px;
    outline: none;
    /* 取消点击时的黑线 */
    font-size: 16px;
    color: #ffffff;
}

select{
    height: 30px;
    width: 110px;
    background: none;
    outline: none;
    /* 取消点击时的黑线 */
    font-size: 17px;
    color: #ffffff;
    padding: 1px 9px;
    border: 1px solid #fff;
    border-radius: 13px;

}

option{
    background-color: rgb(27, 27, 27);
}

.text1{
    font-size: 1.4em;
}

.text2{
    height: 30px;
    width: 120px;
    background: none;
    outline: none;
    /* 取消点击时的黑线 */
    font-size: 17px;
    color: #ffffff;
    padding: 1px 9px;
    border: 1px solid #fff;
    border-radius: 13px;
}

.text_p{
    margin-top: 5px;
    height: 190px;
    width: 200px;
	background: none;
    /* 取消输入框背景色 */
	border: 1px solid #fff;
	border-radius: 13px;
    padding: 1px 15px;
    outline: none;
    /* 取消点击时的黑线 */
    font-size: 19px;
    color: #ffffff;
}

.anniu{
    /* border: 1px solid #fff; */
    width: 450px;
    height: 60px;
    margin: -30px auto;
    /* 上-30 左右水平居中 */
    display: flex;
    align-items: center;
    justify-content: space-around;
    /* 弹性布局 垂直居中 均匀分布 */

}

.button {
	width: 120px;
	height: 50px;
	background: #4d71b8;
	border-radius: 40px;
	text-align: center;
    font-size: 1.6em;
    color: #ffffff;
	float: left;
	margin: 5px 10px;
	cursor:pointer;
    /* 鼠标移入变小手 */
    border: 0;

    
}
.button:hover{
    background:rgb(247, 138, 138);color:#fff;
}

/* .one {
	margin-left: 120px;
}  */

所需图片

 图片来源于网络

  • 14
    点赞
  • 17
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
下面是一个简单的Java可视化界面制作登入界面的示例代码: ```java import javax.swing.*; import java.awt.*; import java.awt.event.*; public class LoginFrame extends JFrame implements ActionListener { private JLabel userLabel, passwordLabel; private JTextField userField; private JPasswordField passwordField; private JButton loginButton; public LoginFrame() { setTitle("登录"); setSize(300, 200); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setLocationRelativeTo(null); JPanel panel = new JPanel(); panel.setLayout(new GridLayout(3, 2)); userLabel = new JLabel("用户名:"); userField = new JTextField(10); panel.add(userLabel); panel.add(userField); passwordLabel = new JLabel("密码:"); passwordField = new JPasswordField(10); panel.add(passwordLabel); panel.add(passwordField); loginButton = new JButton("登录"); loginButton.addActionListener(this); panel.add(loginButton); add(panel); setVisible(true); } public void actionPerformed(ActionEvent e) { String username = userField.getText(); String password = new String(passwordField.getPassword()); if (username.equals("admin") && password.equals("123456")) { JOptionPane.showMessageDialog(this, "登录成功", "提示", JOptionPane.INFORMATION_MESSAGE); } else { JOptionPane.showMessageDialog(this, "用户名或密码错误", "提示", JOptionPane.ERROR_MESSAGE); } } public static void main(String[] args) { new LoginFrame(); } } ``` 运行代码后,会弹出一个窗口,可以在文本框中输入用户名和密码,然后点击“登录”按钮进行验证。如果用户名和密码正确,则会弹出一个消息框提示登录成功,否则会提示用户名或密码错误。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值