HTML笔记

HTML笔记

1、什么是HTML

HTML:Hyper Text Markup Language(超文本标记语言
超文本:包括视频、文字、图片等

1.1 W3C标准

World Wide Web Consortium(万维网联盟)

  1. 结构化标准语言(HTML、XML)
  2. 表现标准语言(CSS)
  3. 行为标准(DOM、ECMAScript)

1.2 HTML的基本结构

<!DOCTYPE html>

<html lang="en">

<!--head标签代表网页头部-->
<head>
    <!-- meta 描述性标签,用来描述我们网站的一些信息  -->
    <meta charset="UTF-8">
    <meta name="keywords" content="狂神说Java">
    <meta name="description" content="欢迎学习">
    <!--title标签代表网页标题    -->
    <title>Title</title>
</head>

<!--body标签代表网页主体-->
<body>
Hello,World!
</body>
</html>

在这里插入图片描述

2、网页标签

2.1网页基本标签

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

<!--段落标签-->
<p>两只老虎,两只老虎,</p>
<p>跑得快,跑得快,</p>
<p>真奇怪!真奇怪!</p>

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

<!--换行标签-->
两只老虎,两只老虎,<br/>
跑得快,跑得快,<br/>
真奇怪!真奇怪!<br/>

<!--粗体  斜体-->
<h1>字体样式标签</h1>
粗体: <strong>i love you</strong>
斜体:  <em>i love you</em>

<br>
<!--特殊符号-->
空格
空 &nbsp;&nbsp;&nbsp;&nbsp;<br/>
&gt;
<br/>
&lt;
<br/>
&copy;

</body>
</html>

2.2 图像标签

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>图像标签</title>
</head>
<body>
<!--img学习
src:图片地址(必填)
     相对地址(推荐使用),绝对地址
    ../   --上一级目录
 alt:图片名字(必填)
-->
<img src="../resource/image/1.jpg" alt="微信头像" title="悬停文字" height="300" width="300">
</body>
</html>

2.3 链接标签

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>链接标签学习</title>
</head>
<body>

<!--使用name作为标记-->
<a name="top">顶部</a>
<a name="down">底部</a>

<!--a标签
herf:必填,表示要跳转到那个界面
target :表示窗口在哪里打开
    _blank:在新标签中打开
    _self:在自己的网页中打开
-->
<a href="1、我的第一个网页.html" target="_blank">点击我跳转到页面</a>
<a href="https://www.baidu.com/ " target="_self">点击我跳转到百度</a>

<br>
<a href="1、我的第一个网页.html">
    <img src="../resource/image/1.jpg" alt="微信头像" title="悬停文字" height="300" width="300">
</a>

<!--锚链接
1、需要一个锚标记
2、跳转到标记-->
<a href="#top">回到顶部</a>

<!--功能性链接
邮件链接:mailto:
QQ链接:-->
<a href="mailto:3037601735@qq.com">请点击联系我</a>
<a target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin=&site=qq&menu=yes">
    <img border="0" src="http://wpa.qq.com/pa?p=2::53" alt="你好,加我学习" title="你好,加我学习"/></a>

</body>
</html>

2.4 列表标签

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>列表学习</title>
</head>
<body>
<!--有序列表-->
<ol>
    <li>Java</li>
    <li>python</li>
    <li>运维</li>
    <li>前端</li>
    <li>c/c++</li>
</ol>
<hr>
<!--无序列表-->
<ul>
    <li>Java</li>
    <li>python</li>
    <li>运维</li>
    <li>前端</li>
    <li>c/c++</li>
</ul>
<!--自定义列表
dl:标签
dt:列表名称
dd:列表内容-->
<hr>
<dl>
    <dt>学科</dt>

    <dd>java</dd>
    <dd>python</dd>
    <dd>linux</dd>
    <dd>c</dd>
</dl>

</body>
</html>

2.5 表格标签

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>表格学习</title>
</head>
<body>
<!--表格table
行   tr
列   td-->
<table border="1px">
    <tr>
    <!--colspan 跨列-->
        <td colspan="3">1-1</td>
	<!--<td>1-2</td>-->
    </tr>
    <tr>
    <!--rowspan 跨行  -->
        <td rowspan="2">2-1</td>
        <td>2-2</td>
    </tr>
    <tr>
        <td>3-1</td>
    <!-- <td>3-2</td>-->
    </tr>
</table>
</body>
</html>

2.6 媒体元素

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>媒体标签</title>
</head>
<body>
<!--音频和视频
src :资源路径
controls:控制条
autoplay :自动播放
-->
<!--<video src="../resource/video/片头.mp4 "controls autoplay></video>-->

<audio src="../resource/audio/萤火虫和你.mp3" controls autoplay></audio>
</body>
</html>

2.7 页面结构

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>页面结构学习</title>
</head>
<body>
<header>
    <h1>网页头部</h1>
</header>

<section>
    <h1>网页主体</h1>
</section>

<footer>
    <h2>网页脚部</h2>
</footer>
</body>
</html>

3、iframe内联框架

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

<!--iframe 内联框架
src: 地址
w-h :宽度,高度
-->
<!--<iframe src="https://www.baidu.com/" frameborder="0" width="1000px" height="800px"></iframe>-->
<iframe src="" name="hello" frameborder="0"></iframe>
<a href="1、我的第一个网页.html " target="hello">点击跳转</a>

<!--<iframe="//player.bilibili.com/player.html?aid=81109044&bvid=BV1YJ411a7dy&cid=138807880&page=1"
    scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true">-->
<!--</iframe>-->
</body>
</html>

4、表单

4.1 表单基本元素

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>登录注册</title>
</head>
<body>
<h1>注册</h1>
<!--表单form
action:表单要提交的位置,可以input type="password"是网页,也可以是一个请求处理的地址
method :get ,post提交方式
        get方式提交:我们可以在url上看到我们提交的信息,不安全,但是高效
        post方式提交:比较安全,传输大文件
-->
<form action="1、我的第一个网页.html" method="get">
<!--文本输入框:<input type="text"
  value="学习使我快乐"   默认初始值
  maxlength="8"        最长能写几个字符
   size="30"           文本框的长度
-->
<p>名字:<input type="text" name="username" ></p>
<!--密码框:input type="password"-->
<p>密码:<input type="password" name="pwd"></p>

<!-- 单选框标签
  input type="radio"
  value:单选框的值
  name:表示组
   -->
    <p>性别
        <input type="radio" value="girl" name="sex"><input type="radio" value="boy" name="sex"></p>

<!--    多选框
input type="checkbox"
-->
<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="../resource/image/1.jpg">
    </p>
    <p>
        <input type="submit">
        <input type="reset">
    </p>

<!--下拉框,列表框-->
    <p>国家:
        <select name="列表名称" >
            <option value="选项的值">中国</option>
            <option value="选项的值">美国</option>
            <option value="选项的值" selected>印度				</option>
            <option value="选项的值">英国</option>
        </select>
    </p>
    
<!--文本域-->
    <p>反馈:
        <textarea name="textarea"  cols="10" rows="10">文本内容</textarea>
    </p>

<!-- 文件域
input type="file" name="files"
-->
    <input type="file" name="files" >
    <input type="button" value="上传" name="uplode">

<!--邮件验证-->
    <p>邮箱:
        <input type="email" name="email">
    </p>
    
<!--url-->
    <p>URL:
        <input type="url" name="url">
    </p>
    
<!-- 数字 -->
    <p>数字:
        <input type="number" max="100" min="0" step="2">
    </p>

<!-- 滑块-->
    <p>音量:
        <input type="range" min="0" max="100" step="2">
    </p>
    
<!--搜索框-->
    <p>搜索:
        <input type="search" name="search">
    </p>

</form>

</body>
</html>

4.2 表单的应用

只读:readonly

禁用:disabled

隐藏域:hidden

<p>名字:<input type="text" name="username" value="admin" readonly ></p>
<input type="radio" value="boy" name="sex" disabled><p>密码:<input type="password" name="pwd" hidden></p>

4.3 表单的初级验证

常用方式:

  1. placeholder 提示信息
  2. required 非空判断
<p>名字:<input type="text" name="username"  placeholder="请输入用户名"></p> 
<p>邮箱:<input type="email" name="email" required></p>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值