HTML-Link-tag
admin
HTML_Link_Tag_code #HTML-Link-tag
The HTML <link>
tag is a powerful element used to connect external resources, such as CSS stylesheets, to your HTML document. It plays a crucial role in web development by allowing you to separate content (HTML) from presentation (CSS).
The <link>
tag is placed within the <head>
section of an HTML document. Here’s the basic syntax:
<link rel="stylesheet" type="text/css" href="styles.css">
The most common use of the <link>
tag is to link external CSS stylesheets. For example:
<link rel="stylesheet" type="text/css" href="http://developerIndian.com/styles.css">
The <link>
tag supports several attributes:
stylesheet
).text/css
).screen
, print
).
Here’s an example of a basic HTML page using the <link>
tag to load an external CSS stylesheet:
<!DOCTYPE html>
<html>
<head>
<title>HTML Link Tag Example</title>
<link rel="stylesheet" type="text/css" href="styles.css">
</head>
<body>
<h1>Welcome to My Web Page</h1>
<p>This is an example of using the HTML link tag to load an external CSS file.</p>
</body>
</html>
<link>
elements to load different resources.<link>
tag is an empty element, meaning it contains attributes only and does not require a closing tag.Ready to use the HTML link tag in your projects? Start by linking your CSS stylesheets and see how it improves your web development workflow!