加载中...

HTML简介


HTML 简介

HTML 实例

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>hello word</title>
</head>
<body>
 
<h1>我的第一个标题</h1>
 
<p>我的第一个段落。</p>
 
</body>
</html>

  • 声明为 HTML5 文档
  • 元素是 HTML 页面的根元素
  • 元素包含了文档的元(meta)数据,如 定义网页编码格式为 utf-8
  • </strong> 元素描述了文档的标题</li> <li><strong><body></strong> 元素包含了可见的页面内容</li> <li><strong><h1></strong> 元素定义一个大标题</li> <li><strong><p></strong> 元素定义一个段落</li> </ul> <p><strong>注:</strong>在浏览器的页面上使用键盘上的 <strong>F12</strong> 按键开启调试模式,就可以看到组成标签。</p> <p><img src="/2024%5C07%5C31%5CHTML%E7%AE%80%E4%BB%8B%5CF12.png"></p> <hr> <h2 id="什么是-HTML"><a href="#什么是-HTML" class="headerlink" title="什么是 HTML?"></a>什么是 HTML?</h2><p>HTML 是用来描述网页的一种语言。</p> <ul> <li>HTML 指的是超文本标记语言: <strong>H</strong>yper<strong>T</strong>ext <strong>M</strong>arkup <strong>L</strong>anguage</li> <li>HTML 不是一种编程语言,而是一种<strong>标记</strong>语言</li> <li>标记语言是一套<strong>标记标签</strong> (markup tag)</li> <li>HTML 使用标记标签来<strong>描述</strong>网页</li> <li>HTML 文档包含了HTML <strong>标签</strong>及<strong>文本</strong>内容</li> <li>HTML文档也叫做 <strong>web 页面</strong></li> </ul> <hr> <h2 id="HTML-标签"><a href="#HTML-标签" class="headerlink" title="HTML 标签"></a>HTML 标签</h2><p>HTML 标记标签通常被称为 HTML 标签 (HTML tag)。</p> <ul> <li>HTML 标签是由<em>尖括号</em>包围的关键词,比如 <html></li> <li>HTML 标签通常是<em>成对出现</em>的,比如 <b> 和 </b></li> <li>标签对中的第一个标签是<em>开始标签</em>,第二个标签是<em>结束标签</em></li> <li>开始和结束标签也被称为<em>开放标签</em>和<em>闭合标签</em></li> </ul> <p><标签>内容</标签></p> <hr> <h2 id="HTML-元素"><a href="#HTML-元素" class="headerlink" title="HTML 元素"></a>HTML 元素</h2><p>“HTML 标签” 和 “HTML 元素” 通常都是描述同样的意思.</p> <p>但是严格来讲, 一个 HTML 元素包含了开始标签与结束标签,如下实例:</p> <p>HTML 元素:</p> <pre class="line-numbers language-markup" data-language="markup"><code class="language-markup"><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>p</span><span class="token punctuation">></span></span>这是一个段落。<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>p</span><span class="token punctuation">></span></span><span aria-hidden="true" class="line-numbers-rows"><span></span></span></code></pre> <hr> <h2 id="Web-浏览器"><a href="#Web-浏览器" class="headerlink" title="Web 浏览器"></a>Web 浏览器</h2><p>Web浏览器(如edge浏览器,360浏览器,谷歌浏览器,Internet Explorer,Firefox,Safari)是用于读取HTML文件,并将其作为网页显示。</p> <p>浏览器并不是直接显示的HTML标签,但可以使用标签来决定如何展现HTML页面的内容给用户:</p> <p><img src="/2024%5C07%5C31%5CHTML%E7%AE%80%E4%BB%8B%5Chtml-first.png"></p> <hr> <h2 id="HTML-网页结构"><a href="#HTML-网页结构" class="headerlink" title="HTML 网页结构"></a>HTML 网页结构</h2><p>下面是一个可视化的HTML页面结构:</p> <p><img src="/2024%5C07%5C31%5CHTML%E7%AE%80%E4%BB%8B%5CHTML%E7%BB%93%E6%9E%84.png"></p> <p>只有 <body> 区域 (白色部分) 才会在浏览器中显示。</p> <hr> <h2 id="HTML版本"><a href="#HTML版本" class="headerlink" title="HTML版本"></a>HTML版本</h2><p>从初期的网络诞生后,已经出现了许多HTML版本:</p> <table> <thead> <tr> <th align="left">版本</th> <th align="left">发布时间</th> </tr> </thead> <tbody><tr> <td align="left">HTML</td> <td align="left">1991</td> </tr> <tr> <td align="left">HTML+</td> <td align="left">1993</td> </tr> <tr> <td align="left">HTML 2.0</td> <td align="left">1995</td> </tr> <tr> <td align="left">HTML 3.2</td> <td align="left">1997</td> </tr> <tr> <td align="left">HTML 4.01</td> <td align="left">1999</td> </tr> <tr> <td align="left">XHTML 1.0</td> <td align="left">2000</td> </tr> <tr> <td align="left">HTML5</td> <td align="left">2012</td> </tr> <tr> <td align="left">XHTML5</td> <td align="left">2013</td> </tr> </tbody></table> <hr> <h2 id="声明"><a href="#声明" class="headerlink" title="<!DOCTYPE> 声明"></a><!DOCTYPE> 声明</h2><!DOCTYPE><p>声明有助于浏览器中正确显示网页。</p> <p>网络上有很多不同的文件,如果能够正确声明HTML的版本,浏览器就能正确显示网页内容。</p> <p>doctype 声明是不区分大小写的,以下方式均可:</p> <pre class="line-numbers language-markup" data-language="markup"><code class="language-markup"><span class="token doctype"><span class="token punctuation"><!</span><span class="token doctype-tag">DOCTYPE</span> <span class="token name">html</span><span class="token punctuation">></span></span> <span class="token doctype"><span class="token punctuation"><!</span><span class="token doctype-tag">DOCTYPE</span> <span class="token name">HTML</span><span class="token punctuation">></span></span> <span class="token doctype"><span class="token punctuation"><!</span><span class="token doctype-tag">doctype</span> <span class="token name">html</span><span class="token punctuation">></span></span> <span class="token doctype"><span class="token punctuation"><!</span><span class="token doctype-tag">Doctype</span> <span class="token name">Html</span><span class="token punctuation">></span></span><span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></code></pre> <hr> <h2 id="通用声明"><a href="#通用声明" class="headerlink" title="通用声明"></a>通用声明</h2><h3 id="HTML5"><a href="#HTML5" class="headerlink" title="HTML5"></a>HTML5</h3><pre class="line-numbers language-markup" data-language="markup"><code class="language-markup"><span class="token doctype"><span class="token punctuation"><!</span><span class="token doctype-tag">DOCTYPE</span> <span class="token name">html</span><span class="token punctuation">></span></span><span aria-hidden="true" class="line-numbers-rows"><span></span></span></code></pre> <h3 id="HTML-4-01"><a href="#HTML-4-01" class="headerlink" title="HTML 4.01"></a>HTML 4.01</h3><pre class="line-numbers language-markup" data-language="markup"><code class="language-markup"><span class="token doctype"><span class="token punctuation"><!</span><span class="token doctype-tag">DOCTYPE</span> <span class="token name">HTML</span> <span class="token name">PUBLIC</span> <span class="token string">"-//W3C//DTD HTML 4.01 Transitional//EN"</span> <span class="token string">"http://www.w3.org/TR/html4/loose.dtd"</span><span class="token punctuation">></span></span><span aria-hidden="true" class="line-numbers-rows"><span></span><span></span></span></code></pre> <h3 id="XHTML-1-0"><a href="#XHTML-1-0" class="headerlink" title="XHTML 1.0"></a>XHTML 1.0</h3><pre class="line-numbers language-markup" data-language="markup"><code class="language-markup"><span class="token doctype"><span class="token punctuation"><!</span><span class="token doctype-tag">DOCTYPE</span> <span class="token name">html</span> <span class="token name">PUBLIC</span> <span class="token string">"-//W3C//DTD XHTML 1.0 Transitional//EN"</span> <span class="token string">"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"</span><span class="token punctuation">></span></span><span aria-hidden="true" class="line-numbers-rows"><span></span><span></span></span></code></pre> <hr> <h2 id="中文编码"><a href="#中文编码" class="headerlink" title="中文编码"></a>中文编码</h2><p>目前在大部分浏览器中,直接输出中文会出现中文乱码的情况,这时候我们就需要在头部将字符声明为 UTF-8 或 GBK。</p> <pre class="line-numbers language-markup" data-language="markup"><code class="language-markup"><span class="token doctype"><span class="token punctuation"><!</span><span class="token doctype-tag">DOCTYPE</span> <span class="token name">html</span><span class="token punctuation">></span></span> <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>html</span><span class="token punctuation">></span></span> <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>head</span><span class="token punctuation">></span></span> <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>meta</span> <span class="token attr-name">charset</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>UTF-8<span class="token punctuation">"</span></span><span class="token punctuation">></span></span> <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>title</span><span class="token punctuation">></span></span> 页面标题<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>title</span><span class="token punctuation">></span></span> <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>head</span><span class="token punctuation">></span></span> <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>body</span><span class="token punctuation">></span></span> <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>h1</span><span class="token punctuation">></span></span>我的第一个标题<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>h1</span><span class="token punctuation">></span></span> <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>p</span><span class="token punctuation">></span></span>我的第一个段落。<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>p</span><span class="token punctuation">></span></span> <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>body</span><span class="token punctuation">></span></span> <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>html</span><span class="token punctuation">></span></span><span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></code></pre> <hr> <p>注:对于设置 <strong><meta charset="utf-8" /></strong> 后出现网页乱码问题,其实归根到底就是:你<strong>通过 *<em>meta*</em> 标签设置的编码</strong>和<strong>网页文件在保存时所使用的文档编码</strong>不相同造成的!</p> <p>至于有的人说什么 360 浏览器默认 <strong>GBK</strong> 会造成乱码,我只想说的是,</p> <p>只要你在 html 文件里写了 **<!doctype hmtl>**和 <strong><meta charset="utf-8" /><strong>,浏览器就绝对会按照 <strong>utf-8</strong> 编码解析网页,没有第二种可能!再次重点说明:</strong>保存 html 文件时,文档编码和 *<em>meta*</em> 设置的编码,一定要相同,只要不相同,就一定会出现乱码!</strong></p> <p>之所以一定要写上 **<!doctype html>**,就是为了防止浏览器的怪异模式,强制浏览器按照标准模式渲染网页!</p> <script src="https://utteranc.es/client.js" repo="2010HCY/utterances" issue-term="title" theme="preferred-color-scheme" crossorigin="anonymous" async> </script> </div> <hr/> <div class="reprint" id="reprint-statement"> <div class="reprint__author"> <span class="reprint-meta" style="font-weight: bold;"> <i class="fas fa-user"> 文章作者: </i> </span> <span class="reprint-info"> <a href="/about" rel="external nofollow noreferrer">Ethaniel</a> </span> </div> <div class="reprint__type"> <span class="reprint-meta" style="font-weight: bold;"> <i class="fas fa-link"> 文章链接: </i> </span> <span class="reprint-info"> <a href="https://100713.xyz/%E7%BC%96%E7%A8%8B/HTML/HTML02.%E7%AE%80%E4%BB%8B">https://100713.xyz/%E7%BC%96%E7%A8%8B/HTML/HTML02.%E7%AE%80%E4%BB%8B</a> </span> </div> <div class="reprint__notice"> <span class="reprint-meta" style="font-weight: bold;"> <i class="fas fa-copyright"> 版权声明: </i> </span> <span class="reprint-info"> 本博客所有文章除特別声明外,均采用 <a href="https://creativecommons.org/licenses/by/4.0/deed.zh" rel="external nofollow noreferrer" target="_blank">CC BY 4.0</a> 许可协议。转载请注明来源 <a href="/about" target="_blank">Ethaniel</a> ! </span> </div> </div> <script async defer> document.addEventListener("copy", function (e) { let toastHTML = '<span>复制成功,请遵循本文的转载规则</span><button class="btn-flat toast-action" onclick="navToReprintStatement()" style="font-size: smaller">查看</a>'; M.toast({html: toastHTML}) }); function navToReprintStatement() { $("html, body").animate({scrollTop: $("#reprint-statement").offset().top - 80}, 800); } </script> <div class="tag_share" style="display: block;"> <div class="post-meta__tag-list" style="display: inline-block;"> <div class="article-tag"> <a href="/tags/%E7%BC%96%E7%A8%8B/"> <span class="chip bg-color">编程</span> </a> <a href="/tags/HTML%E6%A0%87%E8%AE%B0%E8%AF%AD%E8%A8%80/"> <span class="chip bg-color">HTML标记语言</span> </a> </div> </div> <div class="post_share" style="zoom: 80%; width: fit-content; display: inline-block; float: right; margin: -0.15rem 0;"> <link rel="stylesheet" type="text/css" href="/libs/share/css/share.min.css"> <div id="article-share"> <div class="social-share" data-sites="twitter,facebook,google,qq,qzone,wechat,weibo,douban,linkedin" data-wechat-qrcode-helper="<p>微信扫一扫即可分享!</p>"></div> <script src="/libs/share/js/social-share.min.js"></script> </div> </div> </div> <style> #reward { margin: 40px 0; text-align: center; } #reward .reward-link { font-size: 1.4rem; line-height: 38px; } #reward .btn-floating:hover { box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2), 0 5px 15px rgba(0, 0, 0, 0.2); } #rewardModal { width: 320px; height: 350px; } #rewardModal .reward-title { margin: 15px auto; padding-bottom: 5px; } #rewardModal .modal-content { padding: 10px; } #rewardModal .close { position: absolute; right: 15px; top: 15px; color: rgba(0, 0, 0, 0.5); font-size: 1.3rem; line-height: 20px; cursor: pointer; } #rewardModal .close:hover { color: #ef5350; transform: scale(1.3); -moz-transform:scale(1.3); -webkit-transform:scale(1.3); -o-transform:scale(1.3); } #rewardModal .reward-tabs { margin: 0 auto; width: 210px; } .reward-tabs .tabs { height: 38px; margin: 10px auto; padding-left: 0; } .reward-content ul { padding-left: 0 !important; } .reward-tabs .tabs .tab { height: 38px; line-height: 38px; } .reward-tabs .tab a { color: #fff; background-color: #ccc; } .reward-tabs .tab a:hover { background-color: #ccc; color: #fff; } .reward-tabs .wechat-tab .active { color: #fff !important; background-color: #22AB38 !important; } .reward-tabs .alipay-tab .active { color: #fff !important; background-color: #019FE8 !important; } .reward-tabs .reward-img { width: 210px; height: 210px; } </style> <div id="reward"> <a href="#rewardModal" class="reward-link modal-trigger btn-floating btn-medium waves-effect waves-light red">赏</a> <!-- Modal Structure --> <div id="rewardModal" class="modal"> <div class="modal-content"> <a class="close modal-close"><i class="fas fa-times"></i></a> <h4 class="reward-title">你的赏识是我前进的动力</h4> <div class="reward-content"> <div class="reward-tabs"> <ul class="tabs row"> <li class="tab col s6 alipay-tab waves-effect waves-light"><a href="#alipay">支付宝</a></li> <li class="tab col s6 wechat-tab waves-effect waves-light"><a href="#monero">门罗币</a></li> </ul> <div id="alipay"> <img src="/medias/reward/alipay.jpg" class="reward-img" alt="支付宝打赏二维码"> </div> <div id="monero"> <img src="/medias/reward/monero.png" class="reward-img" alt="门罗币打赏二维码"> <b>门罗币钱包地址</b>47JGXgtfPvANa9b29RfGEGRpCsK6<br>2MtffCYvxfcpYBHpikUAxqTXLHs9o<br>XHT4bkszEL9HuDzw5mtkjDk4o2Kx<br>KQmRM6G4vv</p> </div> </div> </div> </div> </div> </div> <script> $(function () { $('.tabs').tabs(); }); </script> </div> </div> <article id="prenext-posts" class="prev-next articles"> <div class="row article-row"> <div class="article col s12 m6" data-aos="fade-up"> <div class="article-badge left-badge text-color"> <i class="fas fa-chevron-left"></i> 上一篇</div> <div class="card"> <a href="/%E7%BC%96%E7%A8%8B/HTML/HTML03.%E7%BC%96%E8%BE%91%E5%99%A8"> <div class="card-image"> <img src="/medias/featureimages/18.webp" class="responsive-img" alt="HTML编辑器"> <span class="card-title">HTML编辑器</span> </div> </a> <div class="card-content article-content"> <div class="summary block-with-text"> HTML 编辑器 HTML 编辑器推荐可以使用专业的 HTML 编辑器来编辑 HTML,我为大家推荐几款常用的编辑器: VS Code:https://code.visualstudio.com/ Sublime Text:http:// </div> <div class="publish-info"> <span class="publish-date"> <i class="far fa-clock fa-fw icon-date"></i>2024-07-31 </span> <span class="publish-author"> <i class="fas fa-bookmark fa-fw icon-category"></i> <a href="/categories/programming/" class="post-category"> 编程 </a> <a href="/categories/programming/HTML%E6%A0%87%E8%AE%B0%E8%AF%AD%E8%A8%80/" class="post-category"> HTML标记语言 </a> </span> </div> </div> <div class="card-action article-tags"> <a href="/tags/%E7%BC%96%E7%A8%8B/"> <span class="chip bg-color">编程</span> </a> <a href="/tags/HTML%E6%A0%87%E8%AE%B0%E8%AF%AD%E8%A8%80/"> <span class="chip bg-color">HTML标记语言</span> </a> </div> </div> </div> <div class="article col s12 m6" data-aos="fade-up"> <div class="article-badge right-badge text-color"> 下一篇 <i class="fas fa-chevron-right"></i> </div> <div class="card"> <a href="/%E7%BC%96%E7%A8%8B/HTML/HTML01.%E6%95%99%E7%A8%8B"> <div class="card-image"> <img src="/medias/featureimages/5.webp" class="responsive-img" alt="HTML教程"> <span class="card-title">HTML教程</span> </div> </a> <div class="card-content article-content"> <div class="summary block-with-text"> HTML 教程- (HTML5 标准) 超文本标记语言(英语:HyperText Markup Language,简称:HTML)是一种用于创建网页的标准标记语言。 您可以使用 HTML 来建立自己的 WEB 站点,HTML 运行在浏览器上 </div> <div class="publish-info"> <span class="publish-date"> <i class="far fa-clock fa-fw icon-date"></i>2024-07-31 </span> <span class="publish-author"> <i class="fas fa-bookmark fa-fw icon-category"></i> <a href="/categories/programming/" class="post-category"> 编程 </a> <a href="/categories/programming/HTML%E6%A0%87%E8%AE%B0%E8%AF%AD%E8%A8%80/" class="post-category"> HTML标记语言 </a> </span> </div> </div> <div class="card-action article-tags"> <a href="/tags/%E7%BC%96%E7%A8%8B/"> <span class="chip bg-color">编程</span> </a> <a href="/tags/HTML%E6%A0%87%E8%AE%B0%E8%AF%AD%E8%A8%80/"> <span class="chip bg-color">HTML标记语言</span> </a> </div> </div> </div> </div> </article> </div> <!-- 代码块功能依赖 --> <script type="text/javascript" src="/libs/codeBlock/codeBlockFuction.js"></script> <!-- 代码语言 --> <script type="text/javascript" src="/libs/codeBlock/codeLang.js"></script> <!-- 代码块复制 --> <script type="text/javascript" src="/libs/codeBlock/codeCopy.js"></script> <!-- 代码块收缩 --> <script type="text/javascript" src="/libs/codeBlock/codeShrink.js"></script> <!-- 代码块功能依赖 --> <script type="text/javascript" src="/libs/codeBlock/codeBlockFuction.js"></script> <!-- 代码语言 --> <script type="text/javascript" src="/libs/codeBlock/codeLang.js"></script> <!-- 代码块复制 --> <script type="text/javascript" src="/libs/codeBlock/codeCopy.js"></script> <!-- 代码块收缩 --> <script type="text/javascript" src="/libs/codeBlock/codeShrink.js"></script> <!-- 代码块折行 --> <style type="text/css"> code[class*="language-"], pre[class*="language-"] { white-space: pre !important; } </style> </div> <div id="toc-aside" class="expanded col l3 hide-on-med-and-down"> <div class="toc-widget card" style="background-color: white;"> <div class="toc-title"><i class="far fa-list-alt"></i>  目录</div> <div id="toc-content"></div> </div> </div> </div> <!-- TOC 悬浮按钮. --> <div id="floating-toc-btn" class="hide-on-med-and-down"> <a class="btn-floating btn-large bg-color"> <i class="fas fa-list-ul"></i> </a> </div> <script src="/libs/tocbot/tocbot.min.js"></script> <script> $(function () { tocbot.init({ tocSelector: '#toc-content', contentSelector: '#articleContent', headingsOffset: -($(window).height() * 0.4 - 45), collapseDepth: Number('0'), headingSelector: 'h2, h3, h4' }); // modify the toc link href to support Chinese. let i = 0; let tocHeading = 'toc-heading-'; $('#toc-content a').each(function () { $(this).attr('href', '#' + tocHeading + (++i)); }); // modify the heading title id to support Chinese. i = 0; $('#articleContent').children('h2, h3, h4').each(function () { $(this).attr('id', tocHeading + (++i)); }); // Set scroll toc fixed. let tocHeight = parseInt($(window).height() * 0.4 - 64); let $tocWidget = $('.toc-widget'); $(window).scroll(function () { let scroll = $(window).scrollTop(); /* add post toc fixed. */ if (scroll > tocHeight) { $tocWidget.addClass('toc-fixed'); } else { $tocWidget.removeClass('toc-fixed'); } }); /* 修复文章卡片 div 的宽度. */ let fixPostCardWidth = function (srcId, targetId) { let srcDiv = $('#' + srcId); if (srcDiv.length === 0) { return; } let w = srcDiv.width(); if (w >= 450) { w = w + 21; } else if (w >= 350 && w < 450) { w = w + 18; } else if (w >= 300 && w < 350) { w = w + 16; } else { w = w + 14; } $('#' + targetId).width(w); }; // 切换TOC目录展开收缩的相关操作. const expandedClass = 'expanded'; let $tocAside = $('#toc-aside'); let $mainContent = $('#main-content'); $('#floating-toc-btn .btn-floating').click(function () { if ($tocAside.hasClass(expandedClass)) { $tocAside.removeClass(expandedClass).hide(); $mainContent.removeClass('l9'); } else { $tocAside.addClass(expandedClass).show(); $mainContent.addClass('l9'); } fixPostCardWidth('artDetail', 'prenext-posts'); }); }); </script> </main> <footer class="page-footer bg-color"> <div class="container row center-align" style="margin-bottom: 0px !important;"> <div class="col s12 m8 l8 copy-right"> Copyright © <span id="year">2024-2025</span> <span id="year">2024</span> <a href="/about" target="_blank">Ethaniel</a> | Powered by <a href="https://hexo.io/" target="_blank">Hexo</a> | Theme <a href="https://github.com/blinkfox/hexo-theme-matery" target="_blank">Matery</a> <br>  <i class="fas fa-chart-area"></i> 站点总字数: <span class="white-color">57.3k</span> 字 <span id="busuanzi_container_site_pv"> | <i class="far fa-eye"></i> 总访问量: <span id="busuanzi_value_site_pv" class="white-color"></span> 次 </span> <span id="busuanzi_container_site_uv"> | <i class="fas fa-users"></i> 总访问人数: <span id="busuanzi_value_site_uv" class="white-color"></span> 人 </span> <br> <a href="https://icp.gov.moe/?keyword=20242713" target="_blank">萌ICP备20242713号</a> <br> </div> <div class="col s12 m4 l4 social-link social-statis"> <a href="mailto:Ethaniel@100713.xyz" class="tooltipped" target="_blank" data-tooltip="邮件联系我" data-position="top" data-delay="50" aria-label="通过电子邮件联系 Ethaniel"> <i class="fas fa-envelope-open"></i> </a> <a href="/atom.xml" class="tooltipped" target="_blank" data-tooltip="RSS 订阅" data-position="top" data-delay="50" aria-label="订阅本站的 RSS"> <i class="fas fa-rss"></i> </a> </div> <script src="/js/prism/prism.js" async></script> </div> </footer> <div class="progress-bar"></div> <!-- 搜索遮罩框 --> <div id="searchModal" class="modal"> <div class="modal-content"> <div class="search-header"> <span class="title"><i class="fas fa-search"></i>  搜索</span> <input type="search" id="searchInput" name="s" placeholder="请输入搜索的关键字" class="search-input"> </div> <div id="searchResult"></div> </div> </div> <script type="text/javascript"> $(function () { var searchFunc = function (path, search_id, content_id) { 'use strict'; $.ajax({ url: path, dataType: "xml", success: function (xmlResponse) { // get the contents from search data var datas = $("entry", xmlResponse).map(function () { return { title: $("title", this).text(), content: $("content", this).text(), url: $("url", this).text() }; }).get(); var $input = document.getElementById(search_id); var $resultContent = document.getElementById(content_id); $input.addEventListener('input', function () { var str = '<ul class=\"search-result-list\">'; var keywords = this.value.trim().toLowerCase().split(/[\s\-]+/); $resultContent.innerHTML = ""; if (this.value.trim().length <= 0) { return; } // perform local searching datas.forEach(function (data) { var isMatch = true; var data_title = data.title.trim().toLowerCase(); var data_content = data.content.trim().replace(/<[^>]+>/g, "").toLowerCase(); var data_url = data.url; data_url = data_url.indexOf('/') === 0 ? data.url : '/' + data_url; var index_title = -1; var index_content = -1; var first_occur = -1; // only match artiles with not empty titles and contents if (data_title !== '' && data_content !== '') { keywords.forEach(function (keyword, i) { index_title = data_title.indexOf(keyword); index_content = data_content.indexOf(keyword); if (index_title < 0 && index_content < 0) { isMatch = false; } else { if (index_content < 0) { index_content = 0; } if (i === 0) { first_occur = index_content; } } }); } // show search results if (isMatch) { str += "<li><a href='" + data_url + "' class='search-result-title'>" + data_title + "</a>"; var content = data.content.trim().replace(/<[^>]+>/g, ""); if (first_occur >= 0) { // cut out 100 characters var start = first_occur - 20; var end = first_occur + 80; if (start < 0) { start = 0; } if (start === 0) { end = 100; } if (end > content.length) { end = content.length; } var match_content = content.substr(start, end); // highlight all keywords keywords.forEach(function (keyword) { var regS = new RegExp(keyword, "gi"); match_content = match_content.replace(regS, "<em class=\"search-keyword\">" + keyword + "</em>"); }); str += "<p class=\"search-result\">" + match_content + "...</p>" } str += "</li>"; } }); str += "</ul>"; $resultContent.innerHTML = str; }); } }); }; searchFunc('/search.xml', 'searchInput', 'searchResult'); }); </script> <!-- 回到顶部按钮 --> <div id="backTop" class="top-scroll"> <a class="btn-floating btn-large waves-effect waves-light" href="#!"> <i class="fas fa-arrow-up"></i> </a> </div> <script src="/libs/materialize/materialize.min.js"></script> <script src="/libs/masonry/masonry.pkgd.min.js"></script> <script src="/libs/aos/aos.js"></script> <script src="/libs/scrollprogress/scrollProgress.min.js"></script> <script src="/libs/lightGallery/js/lightgallery-all.min.js"></script> <script src="/js/matery.js"></script> <!-- Baidu Analytics --> <!-- Baidu Push --> <script async src="/libs/others/busuanzi.pure.mini.js"></script> <script src="/libs/instantpage/instantpage.js" type="module"></script> </body> </html>