繁体中文
设为首页
加入收藏
当前位置:网站制作首页 >> HTML教程 >> HTML 元素

HTML 元素

2007-07-15 08:00:00  作者:  来源:互联网  浏览次数:0  文字大小:【】【】【
简介:HTML documents are text files made up of HTML elements. HTML元素构成了HTML文档 HTML elements are defined using HTML tags. HTML元素由HTML标签定义 HTML Tags HTML标签 HTML tags are used to mark-...
关键字:元素 HTML

HTML documents are text files made up of HTML elements.

HTML元素构成了HTML文档

HTML elements are defined using HTML tags.

HTML元素由HTML标签定义

HTML Tags

HTML标签

HTML tags are used to mark-up HTML elements

HTML 标签用来标识HTML元素

HTML tags are surrounded by the two characters

HTML 标签被<和>这两个符号所包围

The surrounding characters are called angle brackets

这两个符号称作尖括号

HTML tags normally come in pairs like and

HTML 标签成对出现,如和

The first tag in a pair is the start tag, the second tag is the end tag

一对标签中第一个出现的标签为 起始标签, 第二个为 结束标签

The text between the start and end tags is the element content

两标签所夹内容为 元素内容

HTML tags are not case sensitive, means the same as

HTML 标签 不区分大小写, 和 相同

HTML Elements

HTML元素

Remember the HTML example from the previous page:

回忆前一页的HTML实例:

Title of page

This is my first homepage. This text is bold

This is an HTML element:

这是一HTML元素:

This text is bold

The HTML element starts with a start tag:

HTML元素从 开始标签: 开始

The content of the HTML element is: This text is bold

它的 内容 是: 这段文字是加粗的

The HTML element ends with an end tag:

HTML元素的 结束标签为:

The purpose of the tag is to define an HTML element that should be displayed as bold.

使用标签的目的为定义一个HTML元素,它的内容加粗显示。

This is also an HTML element:

这同样是一HTML元素:

This is my first homepage. This text is bold

This HTML element starts with the start tag , and ends with the end tag .

这个HTML元素从标签开始,到结束。

The purpose of the tag is to define the HTML element that contains the body of the HTML document.

标签的目的为定义包含HTML文档主体的HTML元素。

Why do We Use Lowercase Tags?

为何使用小写标签?

We have just said that HTML tags are not case sensitive: means the same as . When you surf the Web, you will notice that most tutorials use uppercase HTML tags in their examples. We always use lowercase tags. Why?

前面提到HTML标签是不区分大小写的:和 是一样的。 在上网冲浪的时候,你可能会注意到很多教材中的例子经常使用大写的HTML标签。 我们使用的却是小写标签。为什么呢?

If you want to prepare yourself for the next generations of HTML, you should start using lowercase tags. The World Wide Web Consortium (W3C) recommends lowercase tags in their HTML 4 recommendation, and XHTML (the next generation HTML) demands lowercase tags.

如果你将为自己进入下一代HTML语言做准备的话,就应该开始使用小写标签。因为W3C组 推荐HTML 4和XHTML(下一代HTML语言)使用小写标签

Tag Attributes

标签属性

Tags can have attributes. Attributes can provide additional information about the HTML elements on your page.

标签可以拥有属性。属性可以为你页面中的HTML元素附加信息。

This tag defines the body element of your HTML page: . With an added bgcolor attribute, you can tell the browser that the background color of your page should be red, like this: .

标签是定义页面body元素的。通过添加bgcolor属性,就可以让浏览器将页面背景显示为红色,像这样:。

This tag defines an HTML table:

. With an added border attribute, you can tell the browser that the table should have no borders:

标签定义的是HTML中的表格(table)元素。通过添加border属性,就可以让浏览器显示无边框的表格,像这样:

Attributes always come in name/value pairs like this: name="value".

属性里名称和值应该一起出现,格式像这样:name="value"。

Attributes are always added to the start tag of an HTML element.

属性应该添加在HTML元素里的起始标签中。

Quote Styles, "red" or 'red'?

引号格式是"red" 还是 'red'?

Attribute values should always be enclosed in quotes. Double style quotes are the most common, but single style quotes are also allowed.

属性的值应该被引号括起来。双引号是标准的格式,单引号也是可以使用的。

In some rare situations, like when the attribute value itself contains quotes, it is necessary to use single quotes:

在一些特殊场合,像当属性值中的内容就已经有双引号,这时候就必须使用单引号,如:

name='John "ShotGun" Nelson'

责任编辑:admin
相关文章