当前位置: 首页 > 网络学院 > 网页制作基础教程 > HTML > 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 Elements
HTML元素
Remember the HTML example from the previous page:
回忆前一页的HTML实例:
<html> |
This is an HTML element:
这是一HTML元素:
<b>This text is bold</b> |
The HTML element starts with a start tag: <b>
HTML元素从 开始标签: <b>开始
The content of the HTML element is: This text is bold
它的 内容 是: 这段文字是加粗的
The HTML element ends with an end tag: </b>
HTML元素的 结束标签为: </b>
The purpose of the <b> tag is to define an HTML element that should be displayed as bold.
使用<b>标签的目的为定义一个HTML元素,它的内容加粗显示。
This is also an HTML element:
这同样是一HTML元素:
<body> |
This HTML element starts with the start tag <body>, and ends with the end tag </body>.
这个HTML元素从<body>标签开始,到</body>结束。
The purpose of the <body> tag is to define the HTML element that contains the body of the HTML document.
<body>标签的目的为定义包含HTML文档主体的HTML元素。
Why do We Use Lowercase Tags?
为何使用小写标签?
We have just said that HTML tags are not case sensitive: <B> means the same as <b>. 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标签是不区分大小写的:<B>和 <b>是一样的。 在上网冲浪的时候,你可能会注意到很多教材中的例子经常使用大写的HTML标签。 我们使用的却是小写标签。为什么呢?
If you want to prepare yourself for the next generations of HTML, you should start using lowercase tags. The World Wide Web Consortium (W
如果你将为自己进入下一代HTML语言做准备的话,就应该开始使用小写标签。因为W
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: <body>. With an added bgcolor attribute, you can tell the browser that the background color of your page should be red, like this: <body bgcolor="red">.
<body>标签是定义页面body元素的。通过添加bgcolor属性,就可以让浏览器将页面背景显示为红色,像这样:<body bgcolor="red">。
This tag defines an HTML table: <table>. With an added border attribute, you can tell the browser that the table should have no borders: <table border="0">
<table>标签定义的是HTML中的表格(table)元素。通过添加border属性,就可以让浏览器显示无边框的表格,像这样:<table border="0">
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'