Home  >  Article  >  Web Front-end  >  HTML Beginner's Guide (2)

HTML Beginner's Guide (2)

黄舟
黄舟Original
2016-12-23 14:41:151133browse

A teaching tool
To see the original file of the information displayed in the current window of your browser, select the View Source (or equivalent) option in the browser menu. The content of the file and all HTML markup will be displayed in a in a new window.

This is a great way to learn to use HTML and master techniques and constructs. Of course, the HTML you see may not necessarily be technically correct. When you are familiar with HTML and have read a lot about it Reference material, you will be able to differentiate between "good" and "bad" HTML.

Remember that you can save the HTML-encoded source file and use it as a template for your web pages, or modify it for other purposes .

HTML tag
HTML
This element indicates that your file contains HTML-encoding information. The file extension .html also indicates that the file is an HTML document and must be used. (If your system is subject to 8.3 filename restrictions( For example., LeeHome.htm), you can use .htm as the extension.)

HEAD
The head element head is the first part of your HTML-encoded document that contains the title. The title is included as part of your browser window Displayed (see below).

TITLE
Title The title element contains the title of your document and serves as a global context to identify its content. The title is usually displayed somewhere in the browser window (usually at the top), rather than in the text Area. The title is also used for display in the hotlist or bookmark list, so the title should be descriptive, unique, and relatively concise. The title is also used in the WAIS service to search the server.

For example, you might include a short book title in a chapter: NCSA Mosaic Guide (Windows): Installation. This title describes the name of the software, the platform it is used on, and the content of the chapter. It is better than simply putting the document Called installation. Much better. Generally your title should be no longer than 64 characters.

BODY
The second and largest part of the HTML document is the body, which contains the content of your document (the part that is displayed in the text area of ​​your browser window) . The tags introduced below are used in the body of HTML documents.

Headings
HTML has six levels of heading fonts, numbered from 1 to 6, with size 1 being the smallest. The heading font is displayed larger or bolder than the normal text font. Each The first heading font in a document should be marked

.

The syntax of the heading font element is:
heading font text
where y is a number from 1 to 6, Specify the heading font level.

Don’t skip heading font levels throughout your document. For example, don’t start with a first-level heading (

) and then follow it with a third-level heading (

).

Paragraphs
Unlike documents in many digital processors, line breaks in HTML files are unimportant. You don't have to worry about the length of the lines in your text (preferably no more than 72 characters). In your source file any Where line breaks can be used, multiple whitespaces are overlapped into one whitespace in your browser.

In the example given in "Minimal HTML Document" the encoding of the first paragraph is

Welcome to the world of HTML.
This is the first paragraph.
While short it is
still a paragraph!



There are line breaks between lines in the source file. Web browsers ignore these line breaks and only encounter another< Start a new paragraph only after the ;p> tag



Important: You must specify a paragraph with the

element. The browser ignores any indentation or blank lines in the source file. If there is no

element, The document will be treated as one large paragraph. (One exception is text marked as "preformatted," described below.) For example, the following output will be exactly the same as the first HTML example:

< ;H1>Level-one heading

Welcome to the world of HTML. This is the
first paragraph. While short it is still a
paragraph!

And this is the second paragraph.



To maintain the readability of HTML files, the title font should be on its own line, add one or two blank lines before starting a new section, and separate paragraphs with blank lines (In addition to using the

tag). This extra whitespace will be useful when you edit the file (but your browser will ignore this whitespace because it has its own rules about whitespace, independent of those in your source file.

Note: The closing tag

can be omitted. This is because when the browser encounters a

tag, it thinks that the previous paragraph ends here.

Use

and

as paragraph markers allow you to center a paragraph by using the ALIGN=alignment attribute in the source file.


This is a centered paragraph. [See output below Form]



This is a centered paragraph.

The above is the content of HTML Beginner’s Guide (2). For more related content, please pay attention to the PHP Chinese website (www.php.cn)!


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:HTML Beginner's Guide (1)Next article:HTML Beginner's Guide (1)