5 分钟学会 HTML 网页制作
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">你是不是想过平常看的网站是怎么制作出来的,并且<span style="color: black;">亦</span>想做一个自己的网站去展示作品、做电商、<span style="color: black;">或</span><span style="color: black;">公司</span>形象官网,又<span style="color: black;">或</span>是想做一名专业的前端工程师,<span style="color: black;">那样</span>这个 5 分钟的视频将教会你网页制作<span style="color: black;">必须</span>的技能 HTML。</p>
<h2 style="color: black; text-align: left; margin-bottom: 10px;"><span style="color: black;">什么是 HTML</span></h2>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">HTML 全<span style="color: black;">叫作</span>是 HyperText Markup Language(超文本标记语言)。想要理解 HTML 很容易,只<span style="color: black;">必须</span>把它想象成是写 word 文档,office word 有图形化界面方便对文字和<span style="color: black;">照片</span>排版,而 HTML 则是用标签来<span style="color: black;">掌控</span>排版,跟 word 相比,HTML 是纯文本,体积小更适合在网络上进行传输,<span style="color: black;">因此</span>浏览器默认支持 HTML 网页的解析。</p>
<h2 style="color: black; text-align: left; margin-bottom: 10px;"><span style="color: black;">编写 HTML</span></h2>
<h3 style="color: black; text-align: left; margin-bottom: 10px;"><span style="color: black;"><span style="color: black;">研发</span><span style="color: black;">工具</span></span></h3>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">编写 HTML 只<span style="color: black;">必须</span><span style="color: black;">运用</span>普通的记事本,<span style="color: black;">亦</span><span style="color: black;">能够</span>用高级的代码编辑器,<span style="color: black;">这儿</span><span style="color: black;">举荐</span><span style="color: black;">运用</span> visual studio code。把这个文本文件的后缀名改为 .html,双击它<span style="color: black;">或</span>拖到浏览器里就能够<span style="color: black;">拜访</span>这个网页。</p>
<h3 style="color: black; text-align: left; margin-bottom: 10px;"><span style="color: black;">HTML 文件的固定结构</span></h3>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">HTML 文件有固定的结构。开头写上:</p><span style="color: black;"><!DOCTYPE <span style="color: black;">html</span>></span>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">告诉浏览器这是一个 html 文档,<span style="color: black;">而后</span>它下边是<html>根标签,<span style="color: black;">亦</span><span style="color: black;">便是</span>最顶层:</p><span style="color: black;"><<span style="color: black;">html</span>></span><span style="color: black;"></<span style="color: black;">html</span>></span>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">标签都是成对<span style="color: black;">显现</span>的,<span style="color: black;">每一个</span>标签<span style="color: black;">运用</span>尖括号加上标签名,结束标签在尖括号的<span style="color: black;">起始</span>写上斜杠/,标签里边<span style="color: black;">能够</span>是文本<span style="color: black;">或</span>嵌套其他标签。</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">接下来是<head>和<body>部分,<head>里面是定义文档的描述信息,<span style="color: black;">例如</span>网站的标题<title>,它会<span style="color: black;">表示</span>在浏览器上;<body> 标签里是<span style="color: black;">详细</span>的网站内容,相当于 word 的正文:</p><span style="color: black;"><!DOCTYPE <span style="color: black;">html</span>></span><span style="color: black;"><<span style="color: black;">html</span>></span> <span style="color: black;"><<span style="color: black;">head</span>></span> <span style="color: black;"><<span style="color: black;">title</span>></span><span style="color: black;">第1</span>个网页<span style="color: black;"></<span style="color: black;">title</span>></span> <span style="color: black;"></<span style="color: black;">head</span>></span> <span style="color: black;"><<span style="color: black;">body</span>></span><span style="color: black;"></<span style="color: black;">body</span>></span><span style="color: black;"></<span style="color: black;">html</span>></span>
<h2 style="color: black; text-align: left; margin-bottom: 10px;"><span style="color: black;">常用标签</span></h2>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">在<span style="color: black;">起始</span>写网页内容之前,先来<span style="color: black;">认识</span>几个常用的标签:</p>
<h3 style="color: black; text-align: left; margin-bottom: 10px;"><span style="color: black;">标题</span></h3>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">标题标签,类似于 word 中的标题格式,有 6 级,从 h1 到 h6,标题字号会越来越小,文字都是加粗<span style="color: black;">表示</span>:</p><h1><h2><h3><h4><h5><h6><p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">例如</span><span style="color: black;">表示</span> 6 个标题层级:</p><span style="color: black;"><<span style="color: black;">h1</span>></span>这是1级标题<span style="color: black;"></<span style="color: black;">h1</span>></span><span style="color: black;"><<span style="color: black;">h2</span>></span>这是2级标题<span style="color: black;"></<span style="color: black;">h2</span>></span><span style="color: black;"><<span style="color: black;">h3</span>></span>这是3级标题<span style="color: black;"></<span style="color: black;">h3</span>></span><span style="color: black;"><<span style="color: black;">h4</span>></span>这是4级标题<span style="color: black;"></<span style="color: black;">h4</span>></span><span style="color: black;"><<span style="color: black;">h5</span>></span>这是5级标题<span style="color: black;"></<span style="color: black;">h5</span>></span><span style="color: black;"><<span style="color: black;">h6</span>></span>这是6级标题<span style="color: black;"></<span style="color: black;">h6</span>></span>
<h1 style="color: black; text-align: left; margin-bottom: 10px;">这是1级标题</h1>
<h2 style="color: black; text-align: left; margin-bottom: 10px;">这是2级标题</h2>
<h3 style="color: black; text-align: left; margin-bottom: 10px;">这是3级标题</h3>这是4级标题这是5级标题这是6级标题<h3 style="color: black; text-align: left; margin-bottom: 10px;"><span style="color: black;">段落标签</span></h3>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">段落标签就像是 word 里的正文文本,用<p>来<span style="color: black;">暗示</span>。<span style="color: black;">例如</span><span style="color: black;">表示</span>一段正文:</p><span style="color: black;"><<span style="color: black;">p</span>></span>这是一段正文<span style="color: black;"></<span style="color: black;">p</span>></span>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">这是一段正文</p>
<h3 style="color: black; text-align: left; margin-bottom: 10px;"><span style="color: black;">文本样式标签</span></h3>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">文本样式标签与 word 文档中的功能一模<span style="color: black;">同样</span>,<b><span style="color: black;">表率</span>加粗,<i><span style="color: black;">表率</span>斜体,<sub><span style="color: black;">表率</span>下标,<del><span style="color: black;">表率</span>删除的文本,<br><span style="color: black;">表率</span>换行,例如下边的文本:</p><span style="color: black;"><<span style="color: black;">p</span>></span> 这是一段文本,<span style="color: black;"><<span style="color: black;">b</span>></span>我是加粗的<span style="color: black;"></<span style="color: black;">b</span>></span>,<span style="color: black;"><<span style="color: black;">i</span>></span>我是斜体<span style="color: black;"></<span style="color: black;">i</span>></span>,带下标的:x<span style="color: black;"><<span style="color: black;">sub</span>></span>2<span style="color: black;"></<span style="color: black;">sub</span> ></span><span style="color: black;"><<span style="color: black;">del</span>></span>我是带删除线的文本<span style="color: black;"></<span style="color: black;">del</span>></span>,<span style="color: black;"><<span style="color: black;">br</span>/></span>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">我是下一行。</p><span style="color: black;"></<span style="color: black;">p</span>></span>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">会<span style="color: black;">表示</span>成:</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">这是一段文本,<strong style="color: blue;">我是加粗的</strong>,我是斜体,带下标的:x2,<span style="color: black;">我是带删除线的文本</span>
</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">,</p>我是下一行。
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">倘若</span>标签之间<span style="color: black;">无</span>其他子标签或文本内容,<span style="color: black;">能够</span>直接在<span style="color: black;">起始</span>标签结束前写上斜杠来结束它,<span style="color: black;">例如</span>例子中的 <br/>。</p>
<h3 style="color: black; text-align: left; margin-bottom: 10px;"><span style="color: black;">列表标签</span></h3>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">列表标签分为两种,一种是<span style="color: black;">没</span>序列表,用<ul><span style="color: black;">暗示</span>,一种是有序列表,用<ol><span style="color: black;">暗示</span>,里边都<span style="color: black;">运用</span><li><span style="color: black;">暗示</span>列表项,例如:</p><span style="color: black;"><span style="color: black;">没</span>序列表</span><span style="color: black;"><<span style="color: black;">ul</span>></span> <span style="color: black;"><<span style="color: black;">li</span>></span>列表项<span style="color: black;"></<span style="color: black;">li</span>></span> <span style="color: black;"><<span style="color: black;">li</span>></span>列表项<span style="color: black;"></<span style="color: black;">li</span>></span> <span style="color: black;"><<span style="color: black;">li</span>></span>列表项<span style="color: black;"></<span style="color: black;">li</span>></span><span style="color: black;"></<span style="color: black;">ul</span>></span>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">列表项</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">列表项</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">列表项</p><span style="color: black;">有序列表</span><span style="color: black;"><<span style="color: black;">ol</span>></span> <span style="color: black;"><<span style="color: black;">li</span>></span>列表项<span style="color: black;"></<span style="color: black;">li</span>></span> <span style="color: black;"><<span style="color: black;">li</span>></span>列表项<span style="color: black;"></<span style="color: black;">li</span>></span> <span style="color: black;"><<span style="color: black;">li</span>></span>列表项<span style="color: black;"></<span style="color: black;">li</span>></span><span style="color: black;"></<span style="color: black;">ol</span>></span>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">列表项</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">列表项</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">列表项</p>
<h3 style="color: black; text-align: left; margin-bottom: 10px;"><span style="color: black;">超链接标签</span></h3>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">超链接<span style="color: black;">亦</span>跟 word 中的<span style="color: black;">同样</span>,用来<span style="color: black;">转</span>到其他 html 文件<span style="color: black;">或</span><span style="color: black;">外边</span>网站,<span style="color: black;">运用</span><a>标签,并<span style="color: black;">运用</span> href 属性设置链接,属性是写在标签中的,以等于号分隔的配置项,等号左边是要配置的项目,右边是值,例如:</p><span style="color: black;"><<span style="color: black;">a</span> <span style="color: black;">href</span>=<span style="color: black;">"http://www.bilibili.com"</span>></span><span style="color: black;">转</span>到 B 站<span style="color: black;"></<span style="color: black;">a</span>></span>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">转</span>到 B 站</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">点击<span style="color: black;">转</span>到 B 站 就会<span style="color: black;">转</span>到href指定的网址。</p>
<h3 style="color: black; text-align: left; margin-bottom: 10px;"><span style="color: black;">多<span style="color: black;">媒介</span>标签</span></h3><span style="color: black;"><span style="color: black;">照片</span>标签</span>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">照片</span>标签用来<span style="color: black;">表示</span><span style="color: black;">照片</span>,<span style="color: black;">运用</span><img>标签,<span style="color: black;">而后</span><span style="color: black;">运用</span>src属性指定<span style="color: black;">照片</span>路径,例如:</p><span style="color: black;"><<span style="color: black;">img</span> <span style="color: black;">src</span>=<span style="color: black;">"./image.jpg"</span> /></span>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">这儿</span>./<span style="color: black;">表率</span>当前目录,<span style="color: black;">这儿</span>只要 html 文件同级目录下有名为image.jpg的文件,就<span style="color: black;">能够</span>把<span style="color: black;">照片</span><span style="color: black;">表示</span>出来。<span style="color: black;">亦</span><span style="color: black;">能够</span>指定网络上的<span style="color: black;">照片</span>的 url <span style="color: black;">位置</span>。下边的视频和音频标签<span style="color: black;">亦</span>是<span style="color: black;">同样</span>。</p><span style="color: black;">视频标签</span>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">视频用<video>标签,它<span style="color: black;">亦</span><span style="color: black;">运用</span>src属性指定路径:</p><span style="color: black;"><<span style="color: black;">video</span> <span style="color: black;">src</span>=<span style="color: black;">"./video.mp4"</span> <span style="color: black;">controls</span>></span><span style="color: black;"></<span style="color: black;">video</span>></span><span style="color: black;">音频标签</span>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">音频<span style="color: black;">运用</span><audio>标签:</p><span style="color: black;"><<span style="color: black;">audio</span> <span style="color: black;">src</span>=<span style="color: black;">"./music.mp3"</span> <span style="color: black;">controls</span>></span><span style="color: black;"></<span style="color: black;">audio</span>></span>
<h3 style="color: black; text-align: left; margin-bottom: 10px;"><span style="color: black;">div 标签</span></h3>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">div 标签<span style="color: black;">能够</span>想象成是用来对其他标签进行分组,把<span style="color: black;">关联</span>的页面区域放到一个 div 下边,以方便<span style="color: black;">调节</span>样式和布局,它<span style="color: black;">无</span><span style="color: black;">实质</span><span style="color: black;">道理</span>,<span style="color: black;">然则</span>它是最常用的标签。假如有一个卡片页面组件,<span style="color: black;">咱们</span><span style="color: black;">能够</span>把卡片标题和内容放到一个 div 下边,这个 div <span style="color: black;">便是</span>卡片整体:</p><span style="color: black;"><<span style="color: black;">div</span>></span> <span style="color: black;"><<span style="color: black;">h3</span>></span>卡片标题<span style="color: black;"></<span style="color: black;">h3</span>></span> <span style="color: black;"><<span style="color: black;">p</span>></span>卡片内容<span style="color: black;"></<span style="color: black;">p</span>></span><span style="color: black;"></<span style="color: black;">div</span>></span>
<h3 style="color: black; text-align: left; margin-bottom: 10px;">卡片标题</h3>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">卡片内容</p>
<h3 style="color: black; text-align: left; margin-bottom: 10px;"><span style="color: black;">布局标签</span></h3>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">在 HTML5 出来以前,网页的布局都是<span style="color: black;">运用</span> div 来分隔<span style="color: black;">区别</span>的部分,<span style="color: black;">例如</span>网页头部、导航、侧边栏、内容、底部等,<span style="color: black;">这般</span><span style="color: black;">所有</span>都是 div 非常难以辨认,<span style="color: black;">因此</span> HTML5 针对这些出了专门的标签,它们其实只是换了名字的 div,<span style="color: black;">然则</span>会让网页布局标签更有<span style="color: black;">道理</span>,<span style="color: black;">运用</span><header><span style="color: black;">表率</span>头部,<nav><span style="color: black;">表率</span>导航,<aside><span style="color: black;">表率</span>侧边栏,<main><span style="color: black;">表率</span>内容,<footer><span style="color: black;">表率</span>底部,<article><span style="color: black;">表率</span><span style="color: black;">文案</span>,<section><span style="color: black;">表率</span>分区,<span style="color: black;">例如</span>首屏轮播图是一个 section,<span style="color: black;">机构</span>业务介绍是另一个 section。</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">更加多</span>的标签和用法<span style="color: black;">能够</span>到:</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">w3schools 英文版</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">w3school 中文版</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">上边去查看。</p>
<h2 style="color: black; text-align: left; margin-bottom: 10px;"><span style="color: black;">实例</span></h2>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">最后来看一个简单的、完整的 html 页面例子,<span style="color: black;">起始</span>有一个导航,导航下有首页和关于<span style="color: black;">咱们</span>两个子菜单,接下来是头部信息,<span style="color: black;">能够</span>是轮播图<span style="color: black;">或</span> hero <span style="color: black;">照片</span>,再下边是侧边栏,<span style="color: black;">重点</span>内容区,<span style="color: black;">重点</span>内容区里有博客部分和<span style="color: black;">机构</span>业务部分,最后是底部信息:</p><span style="color: black;"><!DOCTYPE <span style="color: black;">html</span>></span><span style="color: black;"><<span style="color: black;">html</span>></span> <span style="color: black;"><<span style="color: black;">head</span>></span> <span style="color: black;"><<span style="color: black;">title</span>></span><span style="color: black;">第1</span>个网页<span style="color: black;"></<span style="color: black;">title</span>></span> <span style="color: black;"></<span style="color: black;">head</span>></span> <span style="color: black;"><<span style="color: black;">body</span>></span> <span style="color: black;"><<span style="color: black;">nav</span>></span> <span style="color: black;"><<span style="color: black;">a</span> <span style="color: black;">href</span>=<span style="color: black;">"/"</span>></span>首页<span style="color: black;"></<span style="color: black;">a</span>></span> <span style="color: black;"><<span style="color: black;">a</span> <span style="color: black;">href</span>=<span style="color: black;">"./about_me.html"</span>></span>关于<span style="color: black;">咱们</span><span style="color: black;"></<span style="color: black;">a</span>></span> <span style="color: black;"></<span style="color: black;">nav</span>></span> <span style="color: black;"><<span style="color: black;">header</span>></span>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"> 头部信息</p> <span style="color: black;"></<span style="color: black;">header</span>></span> <span style="color: black;"><<span style="color: black;">aside</span>></span>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"> 侧边栏</p> <span style="color: black;"></<span style="color: black;">aside</span>></span> <span style="color: black;"><<span style="color: black;">main</span>></span> <span style="color: black;"><<span style="color: black;">section</span>></span> <span style="color: black;"><<span style="color: black;">article</span>></span>这是一篇<span style="color: black;">机构</span>的博客<span style="color: black;"></<span style="color: black;">article</span>></span> <span style="color: black;"></<span style="color: black;">section</span>></span> <span style="color: black;"><<span style="color: black;">section</span>></span> <span style="color: black;"><<span style="color: black;">h3</span>></span><span style="color: black;">机构</span>业务<span style="color: black;"></<span style="color: black;">h3</span>></span> <span style="color: black;"><<span style="color: black;">div</span>></span> <span style="color: black;"><<span style="color: black;">div</span>></span>网站<span style="color: black;">研发</span><span style="color: black;"></<span style="color: black;">div</span>></span> <span style="color: black;"><<span style="color: black;">div</span>></span>软件<span style="color: black;">研发</span><span style="color: black;"></<span style="color: black;">div</span>></span> <span style="color: black;"><<span style="color: black;">div</span>></span>App<span style="color: black;">研发</span><span style="color: black;"></<span style="color: black;">div</span>></span> <span style="color: black;"></<span style="color: black;">div</span>></span> <span style="color: black;"></<span style="color: black;">section</span>></span> <span style="color: black;"></<span style="color: black;">main</span>></span> <span style="color: black;"><<span style="color: black;">footer</span>></span>底部信息<span style="color: black;"></<span style="color: black;">footer</span>></span> <span style="color: black;"></<span style="color: black;">body</span>></span><span style="color: black;"></<span style="color: black;">html</span>></span>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">此刻</span>,你就学会编写 HTML 网页了。什么?跟想象的不<span style="color: black;">同样</span>?那是<span style="color: black;">由于</span>还<span style="color: black;">必须</span>一个叫 CSS 的技术来给网页进行修饰和美化,<span style="color: black;">咱们</span>后边的视频继续!</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">我是峰华,感谢观看!</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">点击阅读原文查看<span style="color: black;">更加多</span>、更新<span style="color: black;">文案</span>!</p><img src="https://mmbiz.qpic.cn/mmbiz_png/o5A9q1yjibibMkYOzbsPvA9zp9MfWOs5w1dDYIZfu5OsoLIRGGtQiaJPxH51p8ibg7j0Zv4VV8lYWbDyzzDn5A4TPA/640?wx_fmt=png&tp=webp&wxfrom=5&wx_lazy=1&wx_co=1" style="width: 50%; margin-bottom: 20px;">
i免费外链发布平台 http://www.fok120.com/ 论坛的成果是显著的,但我们不能因为成绩而沾沾自喜。 楼主果然英明!不得不赞美你一下!
页:
[1]