search
HomeWeb Front-endHTML TutorialHTML标签图文详解_html/css_WEB-ITnose

本文主要内容

  • HTML介绍
  • HTML的规范
  • 具体标签的介绍
  • 排版标签
  • 字体标记
  • 图像标记
  • 清单标记
  • 超链接
  • 表格标记
  • 框架标记及
  • 表单标记及语义化
  • 多媒体标记
  • 头标记
  • 一、HTML的介绍

    1、HTML的概述:

    html全称为HyperText Mackeup Language,译为超文本标记语言,不是一种编程语言,是一种描述性的标记语言,用于描述超文本中内容的显示方式。比如字体什么颜色,大小等。

  • 超文本:音频,视频,图片称为超文本。
  • 标记 :称为标记,一个HTML页面都是由各种标记组成。
  • 作用:编写HTML页面。

    注意:HTML语言不是一个编程语言(有编译过程),而是一个标记语言(没有编译过程),HTML页面直接由浏览器解析执行。

    2、HTML的历史:

    3、HTML的网络术语:

  • 网页 :由各种标记组成的一个页面就叫网页
  • 主页(首页) : 一个网站的起始页面或者导航页面
  • 标记:

    称为开始标记 ,

    称为结束标记,也叫标签。每个标签都规定好了特殊的含义。
  • 元素:

    内容

    称为元素.
  • 属性:给每一个标签所做的辅助信息。
  • xhtml: 符合XML语法标准的HTML。
  • dhtml:dynamic,动态的。javascript + css + html合起来的页面就是一个dhtml。
  • http:超文本传协议。用来规定客户端浏览器和服务端交互时数据的一个格式。SMTP 邮件传输协议,ftp:文件传输协议。
  • 4、HTML的编辑工具:

  • NotePad:记事本。
  • EditPlus:语法高亮显示。技巧: 根据颜色判断单词是否出错 (不是100%)。不好的地方:没有代码提示。
  • UltraEdit:根据颜色判断单词是否出错,可以显示2进制数据。
  • Sublime:新一代的代码编辑器。
  • dw(dreamweaver,专业工具) :有代码提示。
  • 二、HTML的规范

  • HTML是一个弱势语言
  • HTML不区分大小写
  • HTML页面的后缀名是html或者htm(有一些系统不支持后缀名长度超过3个字符,比如dos系统)
  • HTML的结构:
    声明部分:主要作用是用来告诉浏览器这个页面使用的是那个标准。是HTML5标准。
    head部分: 不会显示在页面上,作用是告诉服务器一些页面的额外信息。
    body部分:我们所写的代码必须放在此标签?。
  • 例如,打开EditPlus软件,新建一个html文件,自动生成的代码如下:

    <!doctype html><html lang="en"> <head>  <meta charset="UTF-8">  <meta name="Generator" content="EditPlus&reg;">  <meta name="Author" content="">  <meta name="Keywords" content="">  <meta name="Description" content="">  <title>Document</title> </head> <body>   </body></html>

    目前,IE浏览器是完全不支持H5的,支持最好的是Opera浏览器,可以支持95%以上;其次是google,可以支持一部分H5。

    三、HTML的各种标签

    备注

  • 所有的浏览器默认情况下都会忽略空格和空行
  • 每个标签都有私有属性。也都有公有属性。
  • html中表示长度的单位都是像素。HTML只有一种单位就是像素。
  • body:
    bgcolor: 背景颜色。
    background:背景图片。
    text: 文本颜色。
  • 1、排版标签

    注释标签

    <!-- 注释  -->


    段落标签

    <p>This is a paragraph</p><p>This is another paragraph</p>

    属性:

  • align="属性值":对齐方式。属性值包括left center right。
    举例:

  • 换行标签

    当你打算结束一行,而又不想开始一个新段落时,
    标签就派上用场了。无论你将它置于何处,
    标签都会产生一个强制的换行。

    This <br> is a para<br>graph with line breaks

    效果如下:

    上图可以看到,

    标签和
    标签的区别在于:

    标签有空行,而
    标签没有空行;而且
    标签没有属性。
    注意
    没有结束标签,把
    标签写为
    是经得起未来考验的做法,XHTML 和 XML 都接受在打开的标签内部来关闭标签的做法。


    水平线标签

    水平分隔线(horizontal rule)可以在视觉上将文档分隔成各个部分。
    效果如下:

    属性:

  • align="属性值":设定线条置放位置。属性值可选择:left right center。
  • size="2":设定线条粗细。以像素为单位,内定为2。
  • width="500"或width="70%":设定线条长度。可以是绝对值(单位是像素)或相对值。如果设置为相对值的话,内定为100%。
  • color="#0000FF":设置线条颜色。 『只适用于IE』
  • noshade:不要阴影,即设定线条为平面显示。若没有这个属性则表明线条具阴影或立体,这是内定值。
    属性效果演示:

  • 内容居中标签

    此时center代表是一个标签,而不是一个属性值了。只要是在这个标签里面的内容,都会居于浏览器的中间。
    效果演示:

    到了H5里面,center标签不建议使用。


    预定义(预格式化)标签
    
    

    预定义标签

    ,告诉浏览器不要忽略空格和空行。<br>效果演示:   <p></p>   <p>上图中,好像红框部分的字体变小了,而且还出现了缩进,好吧, 这个其实是浏览器搞的鬼。<br>为什么要有</p><pre class="brush:php;toolbar:false">这个标签呢?答案是:    <p>所有的浏览器默认情况下都会忽略空格和空行。</p>    <p>好吧,其实这个标签也用的比较少。</p>   <p><br></p>   <h3>块级标签 <div>   <p>把标签中的额内容作为一个块儿来对待(division)。必须单独占据一行。</p>   <p>属性:</p>    <li>align="属性值":设置块儿的位置。属性值可选择:left right center。</li>    <p><br></p>   <h3>块级标签 <span></span>
    </h3>   <p><span>和<div>唯一的区别在于:<span>是不换行的,而<div>是换行的。<br>效果举例:   <p></p>   <h2 id="字体标签">2、字体标签</h2>   <h3 id="标题">标题</h3>   <p>标题使用</p>
    <h1>至<h6 id="标签进行定义-h-定义最大的标题-h-定义最小的标题-具有align属性-br-效果演示">标签进行定义。<h1>定义最大的标题,<h6>定义最小的标题。具有align属性。<br>效果演示:   </h6>
    </h1>
    </h6>
    </h1>
    <p></p>   <h3>字体标签<font></font>
    </h3>   <p>属性:</p>    <li>color="红色"或color="#ff00cc"或color="new rgb(0,0,255)":设置字体颜色。<br> 设置方式:单词 \ #ff00cc \ rgb(0,0,255)<br>
    </li>   <li>size:设置字体大小。 取值范围只能是:1至7。取值时,如果取值大于7那就按照7来算,如果取值小于1那就按照1来算。如果想要更大的字体,那就只能通过css样式来解决。<br>设置:用’+2’代表值是5 或直接给值<br>
    </li>   <li>
    <p>face="微软雅黑":设置字体类型。注意在写字体时,“微软雅黑”这个字不能写错。<br>举例:</p><pre class='brush:php;toolbar:false;'><font face="微软雅黑" color="#FF0000" size="10">vae</font>

    效果:

    特殊字符

  •  :空格
  • bafb2ef8114e14a0a03f8072bd665043:大于号
  • &:符号&
  • ":双引号
  • ':单引号
  • ©:版权©
  • ™:商标?
  • 绐:文字绐。其实,#32464是汉字绐的unicode编码。
  • 比如说,你想把

    作为一个文本在页面上显示,直接写

    是肯定不行的,因为这代表的是一个段落标签,所以这里需要用到转义字符。应该这么写:

    这是一个HTML语言的<p>标签

    正确的效果如下:

    错误的效果如下:

    其实我们只要记住前三个符号就行了,其他的在需要的时候查一下就行了。而且,EditPlus软件中是可以直接点击这些符号进行选择的:

    粗体标签

    效果:

    下划线标记    中划线标记

    斜体标记

    效果:

    上标   下标

    上小标这两个标签容易混淆,怎么记呢?这样记:b的意思是bottom:底部
    举例:

    O<sup>2</sup>    5<sub>3</sub>

    效果:

    3、超链接

    超链接有三种形式:
    1、外部链接:链接到外部文件。举例:

    <a href="02页面.html">点击进入另外一个文件</a>

    效果:

    2、锚链接
    指给超链接起一个名字,作用是链接到本页面或者其他页面的特定位置。比如说,在网页底部有一个向上箭头,点击箭头后回到顶部,这个就是利用到了锚链接。
    首先我们要创建一个锚,也就是说,使用name属性给那个特定的位置起个名字。效果如下:

    上图中解释:
    11行代码表示,顶部这个猫的名字叫做name1。
    然后在底部设置超链接,点击时将回到顶部。注意上图中红框部分的#号不要忘记了,表示跳到名为name1的特定位置,这是规定。如果少了#号,点击之后,就会跳到name1这个文件或者name1这个文件夹中去。
    如果我们将上图中的第28行代码写成:

    <a href="a.hhml#name1">回到顶部</a>

    那就表示,点击之后,跳转到a.html页面的name1锚点中去。
    3、邮件链接
    代码举例:

    <a href="mailto:smyhvae@163.com">点击进入我的邮箱</a>

    效果:点击之后,会弹出outlook,作用不大。

    超链接的属性:

  • target:告诉浏览器用什么方式来打开目标页面。target属性有以下几个值:
  • _self:在同一个浏览器中显示(默认值)
  • _blank:打开新的浏览器(新的标签页)显示
  • _parent:在父窗口中显示
  • _top:在顶级窗口中显示
    举例:

    <a href="页面2.html" target="_blank">在新的页面中打开新的网页</a>
  • 备注:_parent和_top值只能用在框架中。

    4、图片标签

    img: 代表的就是一张图片。
    属性:

  • src属性:指图片的路径。
    在写图片的路径时,有两种写法:
    写法一:相对路径。相对当前页面所在的路径。两个标记.和.. ,分表代表当前目录和父路径。
    举例1:

    <!-- 当前目录中的图片 --><img  src="/static/imghwm/default1.png"  data-src="2.jpg"  class="lazy" alt="HTML标签图文详解_html/css_WEB-ITnose" ><img  src="/static/imghwm/default1.png"  data-src=".\2.jpg"  class="lazy" alt="HTML标签图文详解_html/css_WEB-ITnose" > <!-- 上一级目录中的图片 --><img  src="/static/imghwm/default1.png"  data-src="..\2.jpg"  class="lazy" alt="HTML标签图文详解_html/css_WEB-ITnose" >

    举例2:

    <img  src="/static/imghwm/default1.png"  data-src="images/1.jpg"  class="lazy" alt="HTML标签图文详解_html/css_WEB-ITnose" >

    上方代码的意思是说,当前页面有一个并列的文件夹images,在文件夹images中存放了一张图片1.jpg
    效果:

  • 写法二:绝对路径。包括以下两种:
    (1)以盘符开始的绝对路径。举例:

    <img  src="/static/imghwm/default1.png"  data-src="C:\Users\smyhvae\Desktop\html\images\1.jpg"  class="lazy" alt="HTML标签图文详解_html/css_WEB-ITnose" >

    (2)网络路径。举例:

    <img  src="/static/imghwm/default1.png"  data-src="http://p1.yokacdn.com/pic/beauty/ytqx/2012/U278P1T117D698193F2577DT20120831155008_maxw808.jpg"  class="lazy" alt="HTML标签图文详解_html/css_WEB-ITnose" >

    各位自己打开上面的网络连接看看是啥。

  • width:宽度
  • height:高度
  • title:提示性文本。公有属性。也就是鼠标悬停时出现的文本。
  • border:给图片加边框(描边),单位是像素,边框的颜色是黑色
  • Alt:当图片显示不出来的时候代替图片显示的内容
    举例:

    <img  src="/static/imghwm/default1.png"  data-src="images/1.jpg"  class="lazy"    style="max-width:90%" height="`188" title="这是美女" alt="HTML标签图文详解_html/css_WEB-ITnose" >

    效果:

  • Alt属性效果演示:

    热点问题

    指的是对图片的局部区域加超链接。
    我们知道,如果给图片加一个超链接,那个点击这个图片的任意区域,都会跳转到新的位置。举例:

    <a href="网页2.html"><img  src="/static/imghwm/default1.png"  data-src="2.jpg"  class="lazy" alt="HTML标签图文详解_html/css_WEB-ITnose" ></a>

    上方代码表明:给图片加一个超链接,那个点击这个图片的任意区域,都会跳转到新的位置。
    现在,我只想对图片的局部区域加超链接,该怎么做呢?这里的难点在于坐标的确定,此时需要用到Dreamweaver。

    上图中,切换到“设计”标签,然后:

    上图中,点击菜单栏插入-图像,导入图片:


    ,在图片上点击右键,选择属性,弹出属性面板:

    上图中,我们可以利用红框部分的地图绘制需要添加超链接的区域。箭头处表示的是要链接到的文件。蓝框部分表示打开新页面的方式,蓝狂部分的new是没有下划线的,它和_blank的含义是一样的。

    局部区域的热点设置完毕后,上图显示,红框部分就是多出的代码,也正是我们需要的代码。多出的代码如下:

    <img src="/static/imghwm/default1.png"  data-src="file:///C|/Users/smyhvae/Desktop/html/1.jpg"  class="lazy" alt=""    style="max-width:90%"  style="max-width:90%" usemap="#Map"/><map name="Map">  <area shape="circle" coords="227,374,63" href="file:///C|/Users/smyhvae/Desktop/html/网页2.html" target="_blank"></map>

    上方代码中,第一行的usemap="#Map"表示我要引用名为Map的地图。
    然后第02至第04行就给出了地图的定义。
    效果演示:

    本文将持续更新。

    Statement
    The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
    What are boolean attributes in HTML? Give some examples.What are boolean attributes in HTML? Give some examples.Apr 25, 2025 am 12:01 AM

    Boolean attributes are special attributes in HTML that are activated without a value. 1. The Boolean attribute controls the behavior of the element by whether it exists or not, such as disabled disable the input box. 2.Their working principle is to change element behavior according to the existence of attributes when the browser parses. 3. The basic usage is to directly add attributes, and the advanced usage can be dynamically controlled through JavaScript. 4. Common mistakes are mistakenly thinking that values ​​need to be set, and the correct writing method should be concise. 5. The best practice is to keep the code concise and use Boolean properties reasonably to optimize web page performance and user experience.

    How can you validate your HTML code?How can you validate your HTML code?Apr 24, 2025 am 12:04 AM

    HTML code can be cleaner with online validators, integrated tools and automated processes. 1) Use W3CMarkupValidationService to verify HTML code online. 2) Install and configure HTMLHint extension in VisualStudioCode for real-time verification. 3) Use HTMLTidy to automatically verify and clean HTML files in the construction process.

    HTML vs. CSS and JavaScript: Comparing Web TechnologiesHTML vs. CSS and JavaScript: Comparing Web TechnologiesApr 23, 2025 am 12:05 AM

    HTML, CSS and JavaScript are the core technologies for building modern web pages: 1. HTML defines the web page structure, 2. CSS is responsible for the appearance of the web page, 3. JavaScript provides web page dynamics and interactivity, and they work together to create a website with a good user experience.

    HTML as a Markup Language: Its Function and PurposeHTML as a Markup Language: Its Function and PurposeApr 22, 2025 am 12:02 AM

    The function of HTML is to define the structure and content of a web page, and its purpose is to provide a standardized way to display information. 1) HTML organizes various parts of the web page through tags and attributes, such as titles and paragraphs. 2) It supports the separation of content and performance and improves maintenance efficiency. 3) HTML is extensible, allowing custom tags to enhance SEO.

    The Future of HTML, CSS, and JavaScript: Web Development TrendsThe Future of HTML, CSS, and JavaScript: Web Development TrendsApr 19, 2025 am 12:02 AM

    The future trends of HTML are semantics and web components, the future trends of CSS are CSS-in-JS and CSSHoudini, and the future trends of JavaScript are WebAssembly and Serverless. 1. HTML semantics improve accessibility and SEO effects, and Web components improve development efficiency, but attention should be paid to browser compatibility. 2. CSS-in-JS enhances style management flexibility but may increase file size. CSSHoudini allows direct operation of CSS rendering. 3.WebAssembly optimizes browser application performance but has a steep learning curve, and Serverless simplifies development but requires optimization of cold start problems.

    HTML: The Structure, CSS: The Style, JavaScript: The BehaviorHTML: The Structure, CSS: The Style, JavaScript: The BehaviorApr 18, 2025 am 12:09 AM

    The roles of HTML, CSS and JavaScript in web development are: 1. HTML defines the web page structure, 2. CSS controls the web page style, and 3. JavaScript adds dynamic behavior. Together, they build the framework, aesthetics and interactivity of modern websites.

    The Future of HTML: Evolution and Trends in Web DesignThe Future of HTML: Evolution and Trends in Web DesignApr 17, 2025 am 12:12 AM

    The future of HTML is full of infinite possibilities. 1) New features and standards will include more semantic tags and the popularity of WebComponents. 2) The web design trend will continue to develop towards responsive and accessible design. 3) Performance optimization will improve the user experience through responsive image loading and lazy loading technologies.

    HTML vs. CSS vs. JavaScript: A Comparative OverviewHTML vs. CSS vs. JavaScript: A Comparative OverviewApr 16, 2025 am 12:04 AM

    The roles of HTML, CSS and JavaScript in web development are: HTML is responsible for content structure, CSS is responsible for style, and JavaScript is responsible for dynamic behavior. 1. HTML defines the web page structure and content through tags to ensure semantics. 2. CSS controls the web page style through selectors and attributes to make it beautiful and easy to read. 3. JavaScript controls web page behavior through scripts to achieve dynamic and interactive functions.

    See all articles

    Hot AI Tools

    Undresser.AI Undress

    Undresser.AI Undress

    AI-powered app for creating realistic nude photos

    AI Clothes Remover

    AI Clothes Remover

    Online AI tool for removing clothes from photos.

    Undress AI Tool

    Undress AI Tool

    Undress images for free

    Clothoff.io

    Clothoff.io

    AI clothes remover

    Video Face Swap

    Video Face Swap

    Swap faces in any video effortlessly with our completely free AI face swap tool!

    Hot Tools

    SAP NetWeaver Server Adapter for Eclipse

    SAP NetWeaver Server Adapter for Eclipse

    Integrate Eclipse with SAP NetWeaver application server.

    DVWA

    DVWA

    Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

    EditPlus Chinese cracked version

    EditPlus Chinese cracked version

    Small size, syntax highlighting, does not support code prompt function

    PhpStorm Mac version

    PhpStorm Mac version

    The latest (2018.2.1) professional PHP integrated development tool

    SublimeText3 Linux new version

    SublimeText3 Linux new version

    SublimeText3 Linux latest version