HTML Tag & Element

本文介绍了HTML的基本概念及其在网页设计中的应用。HTML是一种用于创建网页内容的标记语言,通过使用各种标签来描述文档结构。文章详细解释了HTML标签的用法、元素的概念以及如何组织文档内容。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

What is HTML?

HTML is a markup language for describing web pages. 它是一种用于描述网页的标记语言。

  • HTML stands for Hyper Text Markup Language, a markup language is a set ofmarkup tags
  • HTML tags describe document content 标签描述了HTML文件的内容
  • HTML documents contain HTML tags and plain text, are also called web pages(HTML 文件也被称作网页,由标签和纯文本组成)

HTML Tags (case-insensitive 大小写不敏感)

  • HTML tags are keywords (tag names) surrounded by angle brackets like <html>
  • They normally come in pairs like <b> and </b> 通常成对出现,虽然大部分浏览器可以显示正确HTML without End tag, 但是考虑到严格版本的XHTML,最好还是写上。
  • The first tag in a pair is the start (opening )tag , the second tag is the end (closing ) tag
  • Some HTML elements do not have an end tag like<br>

The World Wide Web Consortium (W3C) recommends lowercase in HTML 4, and demands lowercase tags in XHTML.
W3C 建议在HTML4和XHTML中标签使用小写。因此,尽管 HTML 5 标准没有要求标签小写,我们使用小写的标签。

注意: The text between <body> and </body> is the visible page content. 在body之间的文本才是页面的可视内容

HTML Elements

Strictly speaking, an HTML element is everything between the start tag and the end tag, including the tags. 

严格来说,HTML元素指的是在开标签和闭合标签之间所有的东西,包括这两个标签。

HTML elements can be nested (elements can contain elements 也就是说一个元素的内容可以是其他元素).

HTML elements with no content are called empty elements.

没有内容的元素被称为空元素

<br> is an empty element without a closing tag (it defines a line break 回车).

Tip: In XHTML, all elements must be closed. Adding a slash inside the start tag, like <br />, is the proper way of closing empty elements in XHTML (and XML).

因此尽管HTML 5没有要求空元素要闭合,为了让你的文档对于XML解析器是可读的,记得闭合所有HTML元素。

文件后缀

HTML files should have a .html extension (not .htm).


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值