HTML link tag

 HTML link tag is a tag in the head area, used to control the relationship between web pages and external resources. The most common application is to import css files. All major browsers support HTML <link> tags, especially through <link> tags. Embed css files, but other functions of the <link> tag may not be supported by all browsers.


If you are looking for link syntax in web pages, please refer to " HTML a href Link Attributes " and " HTML Hyperlinks ".

HTML link tag syntax
<link attribute attribute value type>
There are many attributes of HTML <link> tag, such as href, media, rel, rev, target, type, etc. The standard HTML <link> tag does not have an ending tag, and all the information is written in a <link>. There can be multiple different <link> tags in a webpage, and import multiple different files. Each <link> tag must be written in the head area, otherwise the browser will not be able to read it. Please refer to the example for actual writing .

HTML link tag example
<head>
<title>測試網頁</title>
<link rel="stylesheet" type="text/css" href="this_page.css" />
</head>
The example shows the standard HTML <link> tag embedded css file writing, where "rel="stylesheet" type="text/css"" means that it tells the browser to import an external css file. Import a style file named this_page.css through href.

In fact, HTML link itself has many original functions, but considering that many browsers have different levels of support for <link>, in order to avoid writing web pages that cannot be supported by most browsers, we try to avoid using other functions, and <link> Almost all of the default functions can be replaced. For example, the target used to control the link to open the window can be directly written in the a href of the text , and the charset attribute of the web page encoding should also be processed by meta .

Post a Comment

0 Comments