- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
HTML href Attribute
The href attribute of the <link> element is used to set the url of the external resource.
Following is the syntax −
<link href="url">
Above, the url is the url of the linked document. Let us now see an example to implement the href attribute of the <link> element −
Example
<!DOCTYPE html> <html> <head> <link rel="stylesheet" type="text/css" href="new.css"> </head> <body> <h1>Demo Heading</h1> <p>This is demo text.</p> </body> </html>
We have an external document above “new.css”, which is linked using href. This document is a CSS style file −
h1{ color − blue; } p{ background-color − red; }
Output
This will produce the following output. We styled the heading and text in the above “new.css” −
Advertisements