html 常用标签 表单

 

1.常用标签

1.<strong> </strong>---加粗

2.<i> </i>--------字体斜体

3.<u></u>-------下划线

4.<del> </del>------删除线

5.<br>-------换行

6.<hr>-------水平分割线默认100%居中显示)

7.<p> </p>------段落标签 (默认换行 居左和br的区别是p会独自空一行)

8.<sub></sub>----下标(用于一些数学符号的表示或者注释)

9.<sup></sup>----上标

10..<pre></pre>-----输出原文格式

11.<span></sapn>---行内标签(一般用来修饰文本)

12.<h></h>----标题标签

<h1></h1>-------一级标题   <h2></h2>-------二级标题   <h3></h3>-------三级标题  <h4></h4>-------四级标题  <h5></h5>-------五级标题   <h6></h6>-------六级标题

13.<div></div>----盒子标签

2.路径

1.相对路径: 当前文件和相对文件的位置。

2.绝对路径: 绝对路径是指文件在硬盘上真正存在的路径 从盘符开始描述文件位置。(盘符+文件名)

3.表单

1.<from></from>----表单标签

1.from标签中的属性

1.action----实现跳转功能

<form action="表单测试.html" >

2.method----指定提交表单数据时要使用的 HTTP 方法(有POST和GET两种方法 POST方法安全性高于GET方法)

<form action="表单测试.html" method="get">

2.<input></input>----标签

1.input中的属性。

1.size----以字符设置宽度。

<input type="checkbox" size="20">

2.id-----元素的唯一值。

<input type="checkbox" id="足球">

3.maxlength-----元素接受字符的最大值。

:<input type="text" name="username" maxlength="20">

4.checked----元素是否被选中。

<input type="radio" name="单选按钮" value="男" checked>

5.lable----是为了input定义的标签不展示内容(可以让点击文字选择中按钮)

 <label for="足球"><input type="checkbox" id="足球"></label>

6.readonly----输入字段只能读,不能修改。

<input type="text" id="username" name="usename" value="输入用户名" readonly>

7.required----提交信息的时候不能为空。

 <input type="password" required > 

8.autofocus----打开页面自动获取光标。

<input type="password" autofocus> 

9.disabled----禁用input元素,不可被点击选取。

<input type="password" disabled> 

2.input的type的常用格式

1.type=”text”----文本框

<input type="text" name="文本">

2. type=”password”----密码框

<input type="password" name="密码框">

3. type=”submit”----提交按钮

<input type="submit" name=提交按钮" value="提交">

4.type=”radio”----单选按钮(只能选择一个是多个按钮的那么name相同)

<input type="radio" name="单选按钮" value="" checked="checked"> <input type="radio" name="单选按钮" value="">

6. type=”checkbox”----复选按钮(可多个选择)

<input type="checkbox" name="复选按钮" value="复选1">

7. type=”button”----普通按钮

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

8.type=”reset”----复位按钮

 <input type="reset" value="重置按钮">

9. type=”image”----图像按钮

<input type="image" src="洪崖洞.jpg">

10.type=”hidden”----隐藏按钮

<input type="hidden" name="隐藏按钮">

11.type=”file”----选择文件按钮

<input type="file">

12. type=”email”----邮箱框

<input type="email" placeholder="输入邮箱">

13.type=”number”----输入数值框

<input type="number" max="10" min="1">

14.type=”color”----选择颜色框

<input type="color">

15.type=”date”----选择日期框(调取日历)

<input type="date">

16.type=”datetime-local”----选择日期和本地时间

<input type="datetime-local">

17.type=”time”----选择时间

<input type="time">

18.type=”range”----拉条框

<input type="range">

3.<textarea></textarea>----文本区域标签

1.text area中的属性

1.cols----以字符个数设置文本框宽度。

2.rows----以字符个数设置文本框高度。

<textarea name="name" id="num" cols="50" rows="50">这个家伙很懒,来了就走了</textarea>

4.<select></select>----选择标签

1.multiple----规定可以选择多个选项。

2.selected-----规定在页面加载时先预先选择该选项。

5.案例

<!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 align="center" style="background-color: aqua;">
    <h2> 登录/注册</h2>
    <form action="#" method="POST">
        <p> 用户名:<input type="text" name="username" maxlength="20"> </p>
        <p>密 &nbsp; 码:<input type="password" name="userpassword" required maxlength="20" autofocus></p>
        <p>选择你的性别:<label for="男">男<input type="radio" name="sex" id="男"></label> <label for="女">女 <input type="radio"
                    name="sex" id="女"></label> </p>

        <p>请选择你的爱好: <label for="足球"><input type="checkbox" id="足球"> 足球 </label> <label for="篮球"><input type="checkbox"
                    id="篮球"> 篮球 </label> <label for="LOL"><input type="checkbox" id="LOL">LOL</label> <label
                for="韩剧"><input type="checkbox" id="韩剧">韩剧</label><label for="王者荣耀"> <input type="checkbox"
                    id="王者荣耀">王者荣耀</label></p>

        </p>
        <p>邮箱:<input type="email" placeholder="请输入你的邮箱"></p>
        <p>用户头像:<input type="file" value="选择你的文件"></p>
        </p>
    </form>

    <p> 你的家庭住址是: <select>
            <option value=" 西安" selected> 西安 </option>
            <option value="重庆">重庆</option>
            <option value="北京">北京</option>
        </select></p>
    <p>
        你的收货地址是: <select multiple="multiple">
            <option>请选择你的收货地址:</option>
            <option value="永川"> 永川</option>
            <option value="江北" selected>江北</option>
            <option value="万州">万州</option>
        </select>
    </p>

    <p>
        请留下你的建议:
        <textarea name="textarea" id="" cols="30" rows="10"></textarea>
    </p>
    <p>
        选择你喜欢的颜色:<input type="color">
        注册的时间:<input type="datetime-local">
    </p>
    <p>
        <input type="submit" value="登录">
        <input type="reset" value="重置">
    </p>
</body>

</html>

无法查看

 

  • 3
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值