学习HTML第四课

前言

感谢大家的支持,今天我们还是继续一起学习HTML的知识吧!今天我们一起来学习HTML中的表单

标签学习

form

input

text
 
password
 
textarea
 
radio
 
checkbox
 
checked
 
select
 
option
 
value
 
selected
 
multiple
 
file
 
label
 
readonly
 
disabled
 
fieldset
 
legend
 
submit
 
reset
 
button
 
image
 
button

form标签

forn标签的作用于为用户输入创建 HTML 表单

<form></form>

input标签

input标签的作用是在表单建立一个简单的输入框

<input>

text标签

text标签是文本框控件

请输入用户名:<input type="text">

f3789ae44316

password标签

password标签是密码框控件

请输入密码:<input type="password">

fe829107d18f

textarea标签

textareat标签是多行文本框控件

请输入详细地址:
        <textarea name="" id="" cols="30" rows="10"></textarea><!-- cols指定文本区的可见宽度,rows指定文本区的可见行数 -->

4c8719f5d4c2

radio标签

radio标签是单选控件

选择性别:<input type="radio" name="xingbie" checked>男
        <input type="radio" name="xingbie">女

c57b9ea66928

checkbox标签

checkbox标签是多选控件

前端基础包括:<input type="checkbox" checked>HTMl
        <input type="checkbox">CSS
        <input type="checkbox">JS

fe76eb1a32e1

checked标签

checked标签的作用是默认选中该选项,在前面radio标签和checkbox标签中我们都已经展示出来了

select标签

select标签是下拉菜单控件

<select></select>

4c216427c368

option标签

option标签是select标签的子标签,select标签包含一个或多个option子标签

出生日期:
        <select>
            <option value="">1991</option>
            <option value="">1992</option>
            <option value="">1993</option>
            <option value="">1994</option>
            <option value="">1995</option>
            <option value="">1996</option>
            <option value="">1997</option>
            <option value="">1998</option>
            <option value="">1999</option>
        </select>

31a087ccc31b

value标签

value标签的作用是在控件中给定一个默认值

您的手机号: <input type="text" value="150****0000"><!-- value=""的作用是在控件中给定一个默认值 -->

7841f7be59d9

selected标签

selected标签作用是设置默认选项

出生日期:
        <select>
            <option value="">1991</option>
            <option value="">1992</option>
            <option value="">1993</option>
            <option value="">1994</option>
            <option value="">1995</option>
            <option value="">1996</option>
            <option value="" selected>1997</option>
            <option value="">1998</option>
            <option value="">1999</option>
        </select>

b2f5a83f46e4

multiple标签

multiple标签可以选择多个选项

<select name="" id="" multiple size="8">
            <option value="">音乐</option>
            <option value="">电影</option>
            <option value="">短视频</option>
            <option value="">盲盒</option>
            <option value="">漫画</option>
            <option value="">小说</option>
            <option value="">前端</option>
        </select>

b6f630ebf66a

file标签

file标签是选择文件控件

附件:<input type="file">

b2e19a9e90c2

label标签

label标签的作用是使控件得到焦点

<label for="1">请输入用户名:</label><input type="text" id="1">
        <!-- label标签的for=""属性里填写需要得到焦点的控件id="" -->

9112c233313d

readonly标签

readonly标签是只读控件,在只读控件中不能添加和更改内容,但是可以复制只读控件中的内容。

您的手机号: <input type="text" readonly value="150****0000"><!-- value=""的作用是在控件中给定一个默认值 -->

b5b5f6f3fd5f

disabled标签

disabled标签是禁用标签

选择性别: <input type="radio" name="gender">男
        <input type="radio" name="gender">女
        <input type="radio" name="gender" disabled>保密

ddaabf762c18

fieldset标签

fieldset标签是分组控件

<fieldset>
        <legend>基础信息</legend>
        用户名: <input type="text">
        <br>
        密码: <input type="password">
    </fieldset>

42233dbb364c

legend标签

legend标签起标题作用

<legend>基础信息</legend>

5e342a71f6c7

submit标签

submit标签为提交按钮

姓名: <input type="text" name="" id="" target="_self"><!-- target="_self"或target="_blank"的作用是保留控件中填写的内容 -->
        <br>
        邮箱: <input type="text">
        <br>
        <input type="submit">

d3139e7ada33

reset标签

reset标签为重置按钮

姓名: <input type="text" name="" id="" target="_self"><!-- target="_self"或target="_blank"的作用是保留控件中填写的内容 -->
        <br>
        邮箱: <input type="text">
        <br>
        <input type="reset">

468a80664998

button标签

button标签为普通按钮

<input type="button" value="普通按钮">

4d1cafb343b6

image标签

image标签为图片

<input type="image" src="">

63c090f3f8f8

button标签

button标签是双标签,双标签button按钮在form中默认具备点击提交表单的功能

<button>button按钮</button>

93a2a61ea4ab

总结

今天我们的关于表单的html学习就到这里啦,欢迎大家接着来和我一起学习html知识,今天就先这样啦!!!

© 版权声明
THE END
喜欢就支持一下吧
点赞13 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容