HTML header code [reprinted]

Source: Internet
Author: User
Tags html header

It is easy to learn HTML, but learning HTML language alone is definitely not enough, so most people do not take HTML as the learning core, HTML is the only way to learn JavaScript, dynamic language, or CSS. As a result, many people do not pay attention to some other HTML tags. Most of the mainstream books have swept away from this. I think it is the author of the book who knows this and is confused by this. Recently I am lucky to see an introduction to this part of the ancient labels, I want to write it here. Although it is known that HTML has a history of more than a decade, many of the current HTML syntax is old knowledge, so some previous research on HTML does not need to be said, the key point is that these labels are highly portable, so some typical code is widely copied as copies, so that people who can do the website do not have to understand this. This article lists these questions in depth. As mentioned above, there is not much knowledge actually used here. However, if you are really frustrated by these factors, it is hard to know what is wrong with HTML. You can ask people who have worked on the Internet for less than three years. Maybe when they were learning html, their predecessors did not talk about this either.

1. <! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
This is a typical code that is widely copied and not understood, because dreamwear will automatically help you design the code when designing HTML, so you do not need to understand it. Normally, it will not bother you.

This Code comes from the DTD standard. The DTD standard can be understood as a syntax that specifies the label nesting rules. Different DTD files describe different standard DTD. For example, some DTD can recognize the <Baidu> Baidu </Baidu> label, but HTML-specific DTD files (such as: http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd) the <Baidu> </Baidu> label cannot be recognized by written standards. The XML file and the HTML file are specified by the DTD file in the same way. XML is a file that is only responsible for information content. DTD is responsible for the structure of information. XML can be corrected using the specified DTD file to ensure that XML is not messy, which is similar to linkcss in HTML files. The combination of XML and CSS can present webpages. CSS is identified simply by XML personalized tags. The XML tag <A> corresponds to a: {} in CSS :{}. HTML can generally specify styles, label styles, class, and Id attributes. However, the general syntax of tag attributes such as P :{} in CSS is inherited from the xmll + CSS standard. Because HTML is limited by several DTD Files specified by W3C, it becomes HTML, but XML can be limited by any self-written DTD file, therefore, we can simply think that HTML is a special case of XML, but at present, HTML is not just as simple as XML continuation. It adds a lot of things, but HTML sees the XML shadow, because XML is closer to DTD.

To understand this, the following code means:

<! Doctype is the syntax tag of the DTD file specified by XML, just like the <link tag used by the HTML link external CSS, but <! Doctype belongs to the XML interpreter.

Built-in rules (similar to the C language compiler's built-in C language syntax), while <link uses the rules specified by the DTD file, the two are still different.

HTML: Specifies the outermost tag of the current file, which is called the root tag in XML. If it is XML, <! Doctype specifies the DTD, which can be specified

Any string, as long as it corresponds to the root tag of the current XML file, otherwise it is an invalid XML file. Like an invalid C program, the interpreter will report an error.

Public indicates that the specified DTD file is a public file. relative to a private file, that is, the following URL can be accessed by anyone, for example, system.

"-// W3C // dtd xhtml 1.0 transitional // en" specifies the DTD version used by the HTML file. This part is only available for HTML.

W3C refers to the production unit

Dtd xhtml 1.0 is the specified version, and other versions include HTML 4.01.

Transitional is a transitional version, which is generally classified into strict, transitional, and frameset)

En must be short for English.

"Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> specifies the location of the DTD file, which can also be a relative path, absolute path in XML

2. <meta name = "keywords" content = "world, Olympics"/> <meta name = "Description" content = "China Olympic Games, world-renowned."/>

I believe that people who know Seo (Search Engine Optimization) are familiar with this. This line of code is mainly written for search engines such as Google and Baidu, and keywords are keywords, if you use a search engine to search for the keywords you listed here (such as the Olympics), the search engine will distinguish your webpage from a webpage without any Olympic keywords, your webpage is displayed first, that is, the ranking is high. Keywords are separated by commas. Description also refers to the web page description that appears in the small part of the search engine result (the big part is the text in your title tag ). The "keyword" editing and "description" editing (common in CMS) provided by CMS systems and blog management systems are true, these files are output to the line of code on the corresponding article page through PHP Dynamic Language.

Tip: As keyword is abused by a large number of Seo beginners (because keywords have no length or number limit), excellent search engines must be smart enough (such as Google ), sometimes this line of Keywords Code will be ignored, and your keywords will be analyzed directly through HTML Content Retrieval, such as bold color fonts, and various factors (including title, keywords, and description) make a comprehensive analysis of the most important real keywords, instead of allowing you to say exactly what it is in keywords. So now this part is not very significant to Seo, but professional Seo must pay attention to this point.

3. <meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8"/>

Specify character sets. Needless to say, network workers who have suffered losses must have a deep understanding that the character set of a website must be determined at the beginning. Otherwise, it will be very troublesome. gb2312 is intended for Chinese users, if your website is not expected to be accessed by foreign users in the future, choosing gb2312 has the advantage of being lightweight. But the recommended UTF-8, because the database is generally recommended UTF-8, so it is best to use a unified web page Utf-8, UTF-8 is the International can be universal character set, if you use external tools to Process website data in the future will encounter less trouble. Text/html is a Memi type that tells the browser to parse it into the HTML type of the text class. If it is an image or zip, The Memi type will be modified. A typical application is to process images in the GD library of PHP. You must specify this image before entering the image. Otherwise, it will be displayed as Garbled text or HTML by default. PHP will be used to process file downloads. Send a Content-Type value to tell the browser that this is a downloaded file, and the browser will pop up the box. For example, you can download an unpackaged PHP file to the user. Normally, you can click the PHP file to execute PHP on the server. You can only download the file by sending the Memi type of the downloaded file to the browser.

4. <meta http-equiv = "X-UA-compatible" content = "Ie = emulateie7"/>

Put a location first. I personally don't know much about this. Most websites will add this. Open a pitfall first, and I will understand it later.

5. <meta http-equiv = "refresh" content = "3">

The preceding settings enable the HTML page to be automatically refreshed every 3 seconds. You can change the value of 3 to other seconds. This function is not common and has no application value. Some browsers disable this function by default, invalidates the code. An extension is written as <meta http-equiv = "refresh" content = "3: url = http://www.baidu.com">, indicating that the URL will be forwarded to Baidu after 3 seconds on this page, these functions may be used by SEO as "black hats" and are resisted by Some browsers and search engines.

6. <meta http-equiv = "expires" content = "0">

Prohibit the browser from caching this page. By default, the browser caches HTML files. If 0 is changed to another positive number X, it indicates that the cached file expires after X seconds and is cached within x seconds, after x seconds, the request webpage must be reproduced like a server.

7. <meta http-equiv = "winows-tagrget" content = "_ top">

(Disabled) some other websites may use dynamic languages or frameworks to place this page into their own pages. You can use this page to increase access to your pages. This page cannot be used, if the browser sees this line of code, it will promote this page to the top level, occupying the entire browser, rather than being part of another page.

8. <meta http-equiv = "Page-Enter" content = "revealtrans (transition = 22, duration = 1.000)">
<Meta http-equiv = "Page-Exit" content = "revealtrans (transition = 2, duration = 1.000)">

This function is rarely known. It can achieve a page transition effect similar to that in PPT. Page-enter refers to the dynamic effect when you enter this page, and page-exit is vice versa. Select Special Effects for codes. There are 23 special effects in and out. However, if the page has flash, it will damage the effect, and the effect is not outstanding. Currently, it is not the mainstream and rarely used. It is basically invisible to official websites, however, it cannot be ruled out that the current web designers are not familiar with this function.

9. <base href = "http://www.baidu.com"/> <base target = "_ blank"/>

This is used to specify the reference URLs of all relative links on the page. If there is a line of code linked to the picture./ABC/aa.jpg, then click to access the http://www.baidu.com/abc/aa.jpg, if it is written as <base href = "http://www.google.com.hk"/>, then access to www.google.com.hk/abc/aa.jpgthis image.

<Base target = "_ blank"/> is used to specify the default form of opening the page on this page. Here, a new window is changed to open, and the browser opens the page directly by default, unless _ blank is specified on the link or the browser user has special settings for the browser.

In the end, <title> </title> won't be said much, And the <link> mark can link JavaScript, CSS, and other common functions will not be described in detail.

 

The above are some common or visible code in the HTML file header, helping readers understand some knowledge and become excellent programmers, rather than web page Builders without DW.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.