1.1-HTML

HTML

Hyper Text Markup Language


W3C

World Wide Web Consortium 万维网联盟

w3c

china w3c

  • w3c标准包括
    • 结构化标准语言(HTML,XML)
    • 表现标准语言(CSS)
    • 行为标准(DOM,ECMAScript)

1.基本信息

<!--DOCTYPE 使用何种规范-->
<!DOCTYPE html>
<html lang="en">

<!--头部-->
<head>

    <!--描述性标签,描述网站信息-->
    <meta charset="UTF-8">
    <meta name="keywords" content="baidu">
    <meta name="description" content="search for what you want">

    <!--标题-->
    <title>Title</title>
</head>

<!--主体-->
<body>
Hello world!
</body>
</html>

2.基本标签

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>基本标签</title>
</head>
<body>
<!--标题-->
<h1>一级标题</h1>
<h2>二级标题</h2>
<h3>三级标题</h3>
<h4>四级标题</h4>
<h5>五级标题</h5>
<h6>六级标题</h6>

<!--段落-->
<p>p1</p>
<p>p2</p>

<!--换行-->
p1 <br>
p2 <br>

<!--水平线-->
<hr>

<!--字体样式-->
<p>粗体:<strong>html</strong></p>
<p>斜体:<em>html</em></p>

<!--特殊符号-->
<p>空格:h&nbsp;&nbsp;&nbsp;t</p>
<p>大于:&gt;</p>
<p>小于:&lt;</p>
<p>&copy;版权所有ma</p>

</body>
</html>

3.图像标签

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>图像标签</title>
</head>
<body>
<!--
src:图片地址
    相对地址
    绝对地址
alt:图片名字(地址无效将显示)
-->
<img src="../resources/images/bg.jpg" alt="cat" title="悬停文字" width="40%" height="40%">
超链接标签
</body>
</html>

4.超链接标签

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>超链接标签</title>
</head>
<body>
<!--a标签
target:_blank 新标签页中打开
       _self 本标签页中打开
-->
<a href="path" target="目标窗口位置">链接文本或图像</a>

<hr>
<!--锚链接
1.需要一个锚标记
2.跳转到标记
#
-->
<!--使用name作为标记-->
<a name="top">顶部</a>

<a href="#top">回到顶部</a>

<a href="path#top">跳到path的top位置</a>

<hr>

<!--功能性链接
邮件链接:mailto
QQ推广
-->
<a href="mailto:1600325372@qq.com">点击联系me</a>
</body>

</html>

5.行内元素和块元素

  • 块元素
    • 无论内容多少,该元素独占一行
    • p, h1-h6 …
  • 行内元素
    • 内容撑开宽度,左右都是行内元素的可以排在一行
    • a, strong, em …

6.列表

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>列表</title>
</head>
<body>
<!--有序列表-->
<ol>
  <li>c</li>
  <li>c</li>
  <li>c</li>
</ol>

<!--无序列表-->
<ul>
    <li>d</li>
    <li>d</li>
    <li>d</li>
</ul>
<!--自定义列表-->
<dl>
    <dt>标题</dt>

    <dd>内容1</dd>
    <dd>内容1</dd>
    <dd>内容1</dd>
</dl>
</body>
</html>

7.表格

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>表格</title>
</head>
<body>
<table border="3px">
    <!--
    tr:行
    td:列
    rowspan 跨行
    colspan 跨列
    -->
    <tr>
        <td colspan="3">成绩单</td>
    </tr>
    <tr>
        <td rowspan="2">stu1</td>
        <td>math</td>
        <td>69</td>
    </tr>
    <tr>
        <td>English</td>
        <td>44</td>
    </tr>
    <tr>
        <td rowspan="2">stu2</td>
        <td>math</td>
        <td>33</td>
    </tr>
    <tr>
        <td>English</td>
        <td>2</td>
    </tr>
</table>

</body>
</html>

8.媒体元素

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>媒体元素</title>
</head>
<body>
<!--
controls 控制条
autoplay 自动播放
-->
<video src="../resources/videos/26.mp4" controls autoplay width="50%" height="50%"></video>
<br>
<audio src="../resources/audio/晚风.m4a" controls autoplay></audio>
</body>
</html>

9.页面结构

元素名描述
header标记头部区域的内容(用于页面或页面中的一块区域)
footer标记脚部区域的内容(用于整个页面或页面的一块区域)
sectionWeb页面中的一块独立区域
article独立的文章内容
aside相关内容或应用(常用于侧边栏)
nav导航类辅助内容

10.内联框架

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>内联框架</title>
</head>
<body>

<!--<iframe src="//player.bilibili.com/player.html?aid=887905439&bvid=BV1CK4y1w7gM&cid=334571887&page=1"-->
<!--        scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true" > </iframe>-->

<!--
src 地址
name
-->
<iframe src="" name="hello" frameborder="2px"></iframe>
<a href="3_图像标签.html" target="hello">跳转</a>
</body>
</html>

11.表单

  • 表单元素格式

    属性说明
    type指定元素类型:text, password, checkbox, radio, submit, reset, file, hidden, image, button。默认text
    name指定表单元素的名称
    value元素的初始值,type为radio时必须指定一个值
    size指定表单元素的初始宽度,当type为text或password时,表单元素的大小以字符为单位,对于其他类型,宽度以像素为单位
    maxlengthtype为text或password时,输入的最大字符数
    checkedtype为radio或checkbox时,指定按钮是否是被选中
  • 表单的应用

    • readonly
    • hidden
    • disabled
  • 表单的初级验证

    • 常用方式(属性)
      • placeholder 提示信息
      • required 要求不为空
      • pattern 正则验证
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>表单</title>
</head>
<body>

<!--
action 提交表单的位置,可以是网站,也可以是一个请求处理地址
method: post get
  post: 安全,提交大文件
表单提交元素格式 name=value
-->
<form action="1_firstPage.html" method="get">
  <!--
  readonly 只读
  disabled 不可用
  hidden 隐藏
  -->
  <!--文本输入框:input type="text"-->
  <p>name: <input name="name" type="text" maxlength="8" placeholder="请输入用户名" required></p>
  <!--密码输入框:input type="password"-->
  <p>password: <input name="password" type="password" required></p>

  <!--单选框
  value 单选框的值(必须)
  name 相同 位于同一组
  checked 默认选中
  -->
  <p>性别
    <input type="radio" value="boy" name="sex" checked><input type="radio" value="girl" name="sex"></p>

  <!--多选框-->
  <p>爱好
    <input type="checkbox" value="sleep" name="hobby">睡觉
    <input type="checkbox" value="code" name="hobby">代码
    <input type="checkbox" value="chat" name="hobby">聊天
  </p>

  <!--按钮
  input type="button" 普通按钮
  input type="image" 图像按钮
  input type="submit" 提交按钮
  input type="reset" 重置
  -->
  <p>
    <input type="button" name="btn1" value="点击">
    <input type="image" src="../resources/images/bg.jpg" width="10%" height="10%"> <!--点击提交-->
  </p>

  <!--下拉框-->
  <p>
    <select name="列表名称" id="1">
      <option value="China" selected>中国</option>
      <option value="American">美国</option>
      <option value="Indian">印度</option>
      <option value="Switzerland">瑞士</option>
    </select>
  </p>

  <!--文本域-->
  <p>反馈
    <textarea name="textarea" id="2" cols="30" rows="10">文本内容</textarea>
  </p>

  <!--文件-->
  <p>
    <input type="file" name="file">
<!--    <input type="button" value="上传" name="upload">-->
  </p>

  <!--邮件验证-->
  <p>邮箱:
    <input type="email" name="email">
  </p>

  <!--URL-->
  <p>URL:
    <input type="url" name="url">
  </p>

  <!--数字验证-->
  <p>数字:
    <input type="number" name="num" max="100" min="0" step="10">
  </p>
  
  <!--滑块-->
  <p>滑块:
    <input type="range" name="voice" max="100" min="0" step="2">
  </p>

  <!--搜索框-->
  <p>搜索:
    <input type="search" name="search">
  </p>

  <!--增强鼠标可用性-->
  <p>
    <label for="mark">点击试试</label>
    <input type="text" id="mark">
  </p>

  <!--自定义邮箱-->
  <p>自定义邮箱(正则验证)
    <input type="text" name="myEmail" pattern="^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$">
  </p>

  <p>
    <input type="submit">
    <input type="reset" value="清空">
  </p>


</form>

</body>
</html>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值