The anchor tag < a > can be used to:
The tag (anchor tag) in HTML is used to create a hyperlink on the webpage. This hyperlink is used to link the webpage to other web pages or some section of the same web page. It’s either used to provide an absolute reference or a relative reference as its “href” value. Show Syntax: Link Name Attribute: The anchor tag contains many attributes which are listed below.
Example 1: In this example, the GeeksforGeeks HTML Tutorial page will open when you click on the GeeksforGeeks HTML Tutorial link. HTMLOutput: HTML tag Example 2: In this example, we simply redirect from the GeeksforGeeks to the Geeksforgeeks page. HTML
Output: Redirecting the linked text to the site using tag Example 3: In this example, we will use an image to redirect to the Geeksforgeeks page. HTMLOutput: Redirecting the linked image to website using HTML tag Example 4: In this example, we see how an anchor tag can be used to link different sections on the same web page using href attribute and id selector. HTML
CSS
Output : Redirecting to different section on the same page Supported Browsers:
What attribute is used with an anchor a element to specify the name of the browser window that will hold the hyperlinked content?The hypertext reference, or href , attribute is used to specify a target or destination for the anchor element. It is most commonly used to define a URL where the anchor element should link to. In this example, the anchored text links to the URL www.example.com.
What is an on page anchor HTML?An anchor is a piece of HTML code that is used as a bookmark to create a link to a particular section within a page.
|