HTML主体标签

HTML标签

在HTML结构代码中可以看到非常多的<>,这就是html的标签。整块html代码几乎就是由各种各样的标签与标签内容构成,每一个标签对应一个网页上的一个小模块,如一段文字1,一张图片。对于一个网页来说,学习一些常用的标签,90%的网站都可以慢慢搭建出来。

head标签的组成

meta

meta标签共有两个属性,它们分别是http-equiv属性和name属性,不同的属性又有不同的参数值,这些不同的参数值就实现了不同的网页功能。

http-equiv

在html4.01版本中,我们使用下面配置来规定HTML 文档的字符编码。

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

但在html5版本中,我们使用更简化的方式来规定HTML 文档的字符编码。

<meta charset="UTF-8">

我们用meta标签可以声明当前这个html文档的字库,但是一定要和保存的类型一样,否则乱码!

name

主要用于页面的关键字和描述,是写给搜索引擎看的,关键字可以有多个用 ‘,’号隔开,与之对应的属性值为content,content中的内容主要是便于搜索引擎机器人查找信息和分类信息用的。

<meta name="Keywords" content="腾讯,邮箱,游戏,新闻,体育,娱乐,论坛,短信" />

这些关键词,就是告诉搜索引擎,这个网页是干嘛的,能够提高搜索命中率。让别人能够找到你,搜索到。

<meta name="Description" content="网易是中国领先的互联网技术公司,为用户提供免费邮箱、游戏、搜索引擎服务,开设新闻、娱乐、体育等30多个内容频道,及博客、视频、论坛等互动交流,网聚人的力量。" />

设置Description页面描述,那么百度搜索结果,就能够显示这些语句,这个技术叫做SEO(search engine optimization,搜索引擎优化)。

title标签

主要用来告诉用户和搜索引擎这个网页的主要内容是什么,搜索引擎可以通过网页标题,迅速的判断出当前网页的主题。title标签会显示在浏览器的标题栏中。

body

标签body是一个网页的身体部分,也就是用于定义网页的主体内容,也是一个HTML文档中必须的部分。

<body>
  <div id="custom-bg"></div>
  <!-- Container for the OneGoogleBar HTML. -->
  <div id="one-google" class="hidden"></div>

  <div id="ntp-contents">
    <div id="logo">
      <!-- The logo that is displayed in the absence of a doodle. -->
      <div id="logo-default" title="Google"></div>
      <!-- Logo displayed when theme prevents doodles. Doesn't fade. -->
      <div id="logo-non-white" title="Google"></div>
      <!-- A doodle, if any: its link and image. -->
      <div id="logo-doodle">
        <div id="logo-doodle-container">
          <button id="logo-doodle-button">
            <img id="logo-doodle-image" tabindex="-1"></img>
          </button>
        </div>
        <iframe id="logo-doodle-iframe" scrolling="no"></iframe>
        <!-- A spinner, prompting the doodle. Visible on NTPs with customized
             backgrounds. -->
        <button id="logo-doodle-notifier">
          <div class="outer ball0"><div class="inner"></div></div>
          <div class="outer ball1"><div class="inner"></div></div>
          <div class="outer ball2"><div class="inner"></div></div>
          <div class="outer ball3"><div class="inner"></div></div>
        </button>
      </div>
    </div>
</body>
原文地址:https://www.cnblogs.com/aqiao/p/11877496.html