当前位置: 首页 > 网络学院 > 网页制作基础教程 > HTML > HTML 元素

HTML
HTML Head
HTML Meta
HTML URLs
HTML Scripts
HTML 属性
HTML 事件
HTML URL-encode
HTML Web服务器
HTML 摘要
HTML 实例
标签列表
标准属性
事件属性
ASCII码
特殊字符
HTTP状态消息

HTML 元素


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-03-01   浏览: 1306 ::
收藏到网摘: n/a

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 < and >
    HTML
    标签被<>这两个符号所包围
  • The surrounding characters are called angle brackets
    这两个符号称作尖括号
  • HTML tags normally come in pairs like <b> and </b>
    HTML
    标签成对出现,如<b></b>
  • 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, <b> means the same as <B>
    HTML
    标签 不区分大小写, <b> <B>相同

HTML Elements
HTML元素

Remember the HTML example from the previous page:
回忆前一页的HTML实例:

<html>
<head>
<title>Title of page</title>
</head>

<body>
This is my first homepage. <b>This text is bold</b>
</body>
</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 is my first homepage. <b>This text is bold</b>
</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 (W3C) recommends lowercase tags in their HTML 4 recommendation, and XHTML (the next generation HTML) demands lowercase tags.
如果你将为自己进入下一代HTML语言做准备的话,就应该开始使用小写标签。因为W3C 推荐HTML 4XHTML(下一代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: <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'

评论 (3) 1 All

登陆 | 还没注册?