Skip to content
geeksforgeeks
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Tutorials
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
  • Practice
    • Build your AI Agent
    • GfG 160
    • Problem of the Day
    • Practice Coding Problems
    • GfG SDE Sheet
  • Contests
    • Accenture Hackathon (Ending Soon!)
    • GfG Weekly [Rated Contest]
    • Job-A-Thon Hiring Challenge
    • All Contests and Events
  • HTML Tutorial
  • HTML Exercises
  • HTML Tags
  • HTML Attributes
  • Global Attributes
  • Event Attributes
  • HTML Interview Questions
  • HTML DOM
  • DOM Audio/Video
  • HTML 5
  • HTML Examples
  • Color Picker
  • A to Z Guide
  • HTML Formatter
Open In App
Next Article:
How to set the language of text in the linked document in HTML5 ?
Next article icon

How to specify the location of the linked document in HTML5?

Last Updated : 07 Apr, 2021
Comments
Improve
Suggest changes
Like Article
Like
Report

In this article, we will learn how to specify the location of the linked document in HTML5. This can be done by using a href attribute in the <link> element. This has various uses. Most commonly it is used to link stylesheets or favicons to the document.

Syntax:

<link rel="stylesheet" type="text/css" href="style.css">

The below examples illustrate the use of the href attribute.

Example 1: In this example, an external stylesheet's location is specified using the href attribute.

HTML
<html> <head>    <!-- Bootstrap CSS from CDN -->   <link rel="stylesheet"         href= "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">    <!-- Custom styling -->   <style>     h1 {       color: green;     }      h1, h2 {       text-align: center;     }   </style> </head> <body>   <h1>GeeksforGeeks</h1>   <h2>     How to specify the location of the     linked document in HTML5?   </h2> </body> </html> 

Output:

Example 2: In this example, the <a> tag is used to link the document using the href attribute.

HTML
<html> <head>   <style>     h1 {       color: green;     }      body {       text-align: center;     }   </style> </head> <body>   <h1>GeeksforGeeks</h1>   <h2>     How to specify the location of     the linked document in HTML5?   </h2>   <a href="https://ide.geeksforgeeks.org/">     Click to open in the same tab   </a> </body> </html> 

Output:


Next Article
How to set the language of text in the linked document in HTML5 ?

M

manaschhabra2
Improve
Article Tags :
  • Web Technologies
  • HTML
  • HTML5
  • HTML-Questions

Similar Reads

  • How to specify the language of the document in a given link in HTML5 ?
    In the HTML5 language of the document, a given link is specified by hreflang attribute. The value (or languageCode) passed here is the code of the website language. (e.g., if the document/website in the given link is in English en is passed as the value). Example 1: Below is the example that illustr
    1 min read
  • How to specify the main content of a document in HTML5 ?
    The <article> tag is one of the new sectioning element in HTML5. The HTML article tag is used to represent an article. More specifically, the content within the <article> tag is independent of the other content of the site (even though it can be related). In other words, the article elem
    2 min read
  • How to set the language of text in the linked document in HTML5 ?
    The approach of this article is to specify the language of the text in the linked document in HTML5 by using a hreflang attribute in the HTML Tag. The value (or languageCode) passed here is the code of the linked document. (for e.g. if the document/website in the given link is in English en is passe
    1 min read
  • How to specify the URL of the media file in HTML5 ?
    Here we will see how to set the URL of a media file using HTML. To set the URL of media file we use <source> tag. This tag is used to attach multimedia files like audio, video and pictures. The <audio>, <video> and <picture> elements contain the <source> element. Syntax
    1 min read
  • How to set the name for the object in HTML5?
    <object> element in HTML5 is used to link any external files and resources in the form of any image or any nested linked webpages or content or any plugin that can do the same work. Syntax: <object name="name"></object>Elementary uses of <object/ element: Initially <object
    2 min read
  • How to set the size of the linked resource in HTML5 ?
    Approach: We set the sizes of the linked resource by using the sizes attributes in <link> tag in HTML. It is used to specify the sizes of the icon for visual media, and it only works when set to rel=”icon”. It is a read-only property. Syntax: <link sizes="HeightxWidth | any"> Possible va
    2 min read
  • How to specify the address of the document to embed in the iframe element in HTML5?
    The iframe in HTML stands for Inline frame. The “iframe” element in a webpage helps to display another web page document within some particular area or region using the web browser. The inline frame is used to embed another webpage within the current HTML webpage having different attributes for load
    2 min read
  • How to specify language of the target URL in HTML5 ?
    In this article, we will learn how to set the language of the target URL in HTML5. The task can be done by using the hreflang attribute while using the <area> tag. This property contains the value i.e languageCode which represents the two-letter code of the linked document language. Note: If t
    1 min read
  • How to specify media type of the target URL in HTML5 ?
    You can easily specify the media type of the target URL in HTML5 using the media attribute of HTML. This attribute is used to specify that the target URL is designed for special devices (like iPhone, Android, etc), speech or print media, projectors, tv, and so on. Syntax: <a href="" media="screen
    2 min read
  • How to specify the type of the media resource in HTML5 ?
    Here, we will see how to set the media type of the media resource using HTML. To select the media type of media resource we use the <source> tag. This tag is used to attach multimedia files like audio, video, and pictures to a web page or website. The <audio>, <video>, and <pict
    1 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences