HTML中的表单的使用

在这里插入图片描述1.input的基本使用:

<body>
    <!-- 写什么就显示什么 -->
    文本框:<input type="text">
    <br>
    <br>
    <!-- 书写的所有内容都为点点点显示 -->
    密码框:<input type="password">
    <br>
    <br>
   单选框: <input type="radio">
   <br>
   <br>
   多选框:<input type="checkbox">
   <br>
   <br>
   上传文件:<input type="file" name="" id="">
</body>

2.占位符:

<body>
<input type="text" placeholder="请输入用户名">
<br>
<br>
<input type="password" placeholder="请输入密码">
</body>

3.单选框:

<body>
    性别:<input type="radio" name="sex"><input type="radio" name="sex" checked>
    <br>
    <input type="checkbox" checked>
</body>

4.上传文件;

<body>
    <!-- 上传多个文件 -->
    <input type="file" multiple>
</body>

5.按钮input;

<body>
    用户名:<input type="text">
    <br>
    <br>
    密码:<input type="password">
    <br>
    <br>
    <!-- 按钮 -->
    <input type="submit" value="免费注册">
    <input type="reset">
    <input type="button" value="普通按钮">
</body>

6.按钮button:

<body>
    <button>我是按钮</button>
    <br>
    <button type="submit">提交按钮</button>
    <button type="reset">重置按钮</button>
    <button type="button">普通按钮</button>
</body>

7.下拉表单:

<body>
    <select>
        <option >北京</option>
        <option >上海</option>
        <option >广州</option>
        <option selected>深圳</option>
        <!-- selected 默认选项 -->

    </select>
</body>

8.文本标签域:

<body>
    <textarea name="" id="" cols="30" rows="10"></textarea>
</body>

10:点字实现表单中的选中:

性别:<input type="radio" name="sex" id="nan"><label for="nan"></label>
        <label > <input type="radio" name="sex"></label>
        <!-- 点字实现表单的选中 -->

11.综合案例:

<!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">
    <title>Document</title>
</head>
<body>
    <h1>青春不常在,抓紧谈恋爱</h1>
    <hr>
    <form action=""></form>
    昵称:<input type="text" placeholder="请输入昵称">
    <br>
    <br>
    性别:
    <label ><input type="radio" name="sex" checked></label>
    <label ><input type="radio" name="sex"></label>
    <br>
    <br>
    所在城市:
    <select >
        <option >北京</option>
        <option selected>上海</option>
        <option >深圳</option>
    </select>
    <br>
    <br>
    婚姻状况:
    <label ><input type="radio" name="" checked>未婚</label>
    <label ><input type="radio" name="" >已婚</label>
    <label ><input type="radio" name="" >保密</label>
    <br>
    <br>
    喜欢的类型:
    <label ><input type="checkbox" checked>可爱的</label>
    <label ><input type="checkbox" checked>性感的</label>
    <label><input type="checkbox">御姐</label>
    <br>
    <br>
    个人介绍:
    <br>
    <textarea name="" id="" cols="60" rows="10"></textarea>
    <h3>我承诺</h3>
    <ul>
        <li>我年满18岁、单身</li>
        <li>我年满18岁、单身</li>
        <li>我年满18岁、单身</li>
    </ul>
    <input type="checkbox">我同意所有条款
    <br>
    <br>
    <!-- input标签和button标签 -->
    <input type="submit" value="免费注册">
    <button type="reset">重置</button>
</body>
</html>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值