Web前端 -- HTML5 --- 杂记

HTML5 --- 杂记

示例1

文本输入框 密码输入框 单选按钮 复选框 下拉列表 提交按钮

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title> Title  Two </title>
</head>
<body>

    <h2>表单</h2>

    <form action="/" method="post">
        <!-- 文本输入框 -->
        <label for="name">用户名:</label>
        <input type="text" id="name" name="name" required>

        <br>

        <!-- 密码输入框 -->
        <label for="password">密码:</label>
        <input type="password" id="password" name="password" required>

        <br>

        <!-- 单选按钮 -->
        <label>性别:</label>
        <input type="radio" id="male" name="gender" value="male" checked>
        <label for="male"></label>
        <input type="radio" id="female" name="gender" value="female">
        <label for="female"></label>

        <br>

        <!-- 复选框 -->
        <input type="checkbox" id="subscribe" name="subscribe" checked>
        <label for="subscribe">订阅推送信息</label>

        <br>

        <!-- 下拉列表 -->
        <label for="country">国家:</label>
        <select id="country" name="country">
            <option value="cn">CN</option>
            <option value="usa">USA</option>
            <option value="uk">UK</option>
        </select>

        <br>

        <!-- 提交按钮 -->
        <input type="submit" value="提交">
    </form>
</body>
</html>

运行结果 :
在这里插入图片描述

示例2

多级标题 链接 段落 表格 图片

<!DOCTYPE html>          <!-- 声明为 HTML5 文档 -->
<html lang="en">         <!-- 向搜索引擎表示该页面是html语言,并且语言为英文网站 -->
<head>                   <!-- 描述头部元素 -->
    <meta charset="UTF-8">          <!-- 定义网页编码格式为 utf-8 -->
    <title> This is title </title>  <!-- 页面标题 浏览器 页卡标题-->
</head>
<body>                    <!-- 只有 body 中的内容会在页面中显示 -->
    <h1>一级标题  <a href="https://www.baidu.com"> 百度 </a> </h1>

    <p>段落1</p>

    <hr>

    <h2>二级标题</h2>

    <p>段落2</p>

    <h3>三级标题</h3>
    <h4>四级标题</h4>
    <h5>五级标题</h5>
    <h6>六级标题</h6>

    <p>
        <a href="https://www.baidu.com"> 百度 </a>
    </p>

    <p>
        <code>一段电脑代码 print("Hello World")</code>
    </p>

    <p>
        局部路径加载图片 限制图片显示大小 <br>  <!-- br标签为换行符 -->
        <img src="../src/faultMark.png" style="width: 22px" alt="PNG 图片不存在">
    </p>

    <p>
        局部路径加载图片 限制图片显示大小 <br>  <!-- br标签为换行符 -->
        <img src="../src/error.png" alt="PNG 图片不存在" width="22" height="22">  <!-- alt 为图片加载异常时的显示 -->
    </p>

    <p>
        使用网络地址的图片 <br>  <!-- br标签为换行符 -->
        断网 + 清除浏览器缓存后 = 会显示 PNG 图片不存在 <br>  <!-- br标签为换行符 -->
        <img src="https://www.runoob.com/images/pulpit.jpg" alt="PNG 图片不存在" width="304" height="228">
    </p>

    <table border="1">
        <tr>
            <th>Header 1</th>
            <th>Header 2</th>
        </tr>
        <tr>
            <td>row 1, cell 1</td>
            <td>row 1, cell 2</td>
        </tr>
        <tr>
            <td>row 2, cell 1</td>
            <td>row 2, cell 2</td>
        </tr>
    </table>
</body>
</html>

运行结果 :
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值