当前位置: 首页 > 网络学院 > 网页制作基础教程 > HTML > HTML 介绍
What is an HTML File?
什么是HTML文件?
Do You Want to Try It?
你想尝试一下吗?
If you are running Windows, start Notepad.
如果你使用的是WINDOWS操作系统,请打开记事本。
If you are on a Mac start SimpleText.
如果你使用的是苹果机请打开SimpleText程序
In OSX start TextEdit and change the following preferences: Open the the "Format" menu and select "Plain text" instead of "Rich text". Then open the "Preferences" window under the "Text Edit" menu and select "Ignore rich text commands in HTML files". Your HTML code will probably not work if you do not change the preferences above!
如是OSX系统, 请使用TextEdit并改变以下参数: 选择 (在属性窗口) "纯文本" 变为 "多元文本" , 然后再选择 "Ignore rich text commands in HTML files". 这步十分关键, 如果不做的话就无法让HTML代码起作用。
Type in the following text:
输入以下内容:
<html> |
Save the file as "mypage.htm".
将文件保存为"mypage.htm"
Start your Internet browser. Select "Open" (or "Open Page") in the File menu of your browser. A dialog box will appear. Select "Browse" (or "Choose File") and locate the HTML file you just created - "mypage.htm" - select it and click "Open". Now you should see an address in the dialog box, for example "C:MyDocumentsmypage.htm". Click OK, and the browser will display the page.
打开你的浏览器. 在你的浏览器文件菜单中选择 "打开" (或 "打开页面") . 出现一个对话框. 选择 "浏览器" (或 "选择文件") 再选中你建立的文件 - "mypage.htm" - 点击 "打开". 这时地址栏中会出现文件的地址, 比如 "C:MyDocumentsmypage.htm". 浏览器窗口内会显示页面内容.
Example Explained
解析实例
The first tag in your HTML document is <html>. This tag tells your browser that this is the start of an HTML document. The last tag in your document is </html>. This tag tells your browser that this is the end of the HTML document.
HTML文档中的第一个标签为 <html>. 该标签传达给浏览器的信息:这是HTML代码开始的位置. 由此可知 </html>是HTML代码结束的位置.
The text between the <head> tag and the </head> tag is header information. Header information is not displayed in the browser window.
在 <head> 和 </head> 标签之间的内容是这个HTML的顶部信息,它不会显示在浏览器窗口内.
The text between the <title> tags is the title of your document. The title is displayed in your browser's caption.
在 <title> 和 </title> 标签之间的内容是这个HTML文档的标题信息,内容会出现在浏览器的标题栏.
The text between the <body> tags is the text that will be displayed in your browser.
在 <body> 和 </body> 标签之间的内容为文档的主要显示内容,会出现在浏览器窗口内
The text between the <b> and </b> tags will be displayed in a bold font.
在 <b> 与 </b> 之间的内容会以粗字体显示
HTM or HTML Extension?
用HTM扩展名还是HTML呢
When you save an HTML file, you can use either the .htm or the .html extension. We have used .htm in our examples. It might be a bad habit inherited from the past when some of the commonly used software only allowed three letter extensions.
你可以选择其中任意一个,效果是一样的. 这里使用.htm扩展只是举个例子.有些软件只能打开3个字符的扩展名时就使用.htm
With newer software we think it will be perfectly safe to use .html.
如使用比较新的软件, 用.html更为妥当
Note on HTML Editors:
有关HTML编辑器的提示
You can easily edit HTML files using a WYSIWYG (what you see is what you get) editor like FrontPage, Claris Home Page, or Adobe PageMill instead of writing your markup tags in a plain text file.
你可用WYSIWYG(所见即所得)像FrontPage这样的编辑器来轻松编辑HTML文件
But if you want to be a skillful Web developer, we strongly recommend that you use a plain text editor to learn your primer HTML.
但你想成为熟练的WEB开发人员,我们强烈推荐你使用纯文字编辑器来学习HTML
Frequently Asked Questions
常见问答
Q: After I have edited an HTML file, I cannot view the result in my browser. Why?
A: Make sure that you have saved the file with a proper name and extension like "c:mypage.htm". Also make sure that you use the same name when you open the file in your browser.
问:我已经编辑了HTML文件,为什么却无法在我的浏览器里查看呢?
答:你是否恰当地保存了文件?文件名是否正确?浏览器的地址是否正确?
Q: I have tried to edit an HTML file but the changes don't show in the browser. Why?
A: The browser caches your pages so it doesn't have to read the same page twice. When you have changed a page, the browser doesn't know that. Use the browser's refresh/reload button to force the browser to read the edited page.
问:我已经修改了HTML文件但为什么浏览器里的结果没有改变?
答:浏览器缓存已经保存了你修改前的页面,要让浏览器重新加载信息请点"刷新"
Q: What browser should I use?
A: You can do all the training with all of the common browsers, like Internet Explorer, Mozilla, Netscape, or Opera. However, some of the examples in our advanced classes require the latest versions of the browsers.
问:我应该使用哪款浏览器呢?
答:你可以用目前市场上流行的任何一款浏览器,如IE,MOZILLA,NETSCAPE或OPERA。但一些实例演示需要使用最新版本的浏览器。
Q: Does my computer have to run Windows? What about a Mac?
A: You can do all your training on a non-Windows computer like a Mac. However, some of the examples in our advanced classes require a newer version of Windows, like Windows 98 or Windows 2000.
问:是不是我必须在WINDOWS操作系统下才行?是MAC该怎么办?
答:有些实例需要较新版本的WINDOWS系统,一般的实例可以在非WINDOWS操作系统下完成。