HTML Text Link
Use of Base Path
Use of Base Path
It specifies a default URL and a default target for all links on a page. The <base> tag specifies the base URL/target for all relative URLs in a document. There can be at maximum one <base> element in a document, and it must be inside the <head> element. If the <base> tag is present, it must have either an href attribute or a target attribute, or both.
Example
<!DOCTYPE html> <html> <head> <title>Hyperlink Example</title> <base href = "http://www.risingquotes.com"> </head> <body> <p>Click following link</p> <a href = "http://www.risingquotes.com" target = "_blank">Rising Quotes</a> </body> </html>
Output
Download Link
Download Link
You can create text link to make your PDF, or DOC or ZIP files downloadable. This is very simple; you just need to give complete URL of the downloadable file as follows −
Example
<!DOCTYPE html> <html> <body> <a href = "http://www.risingquotes.pdf">Download PDF File</a> </body> </html>
Output
File Download Dialog Box
File Download Dialog Box
Sometimes it is desired that you want to give an option where a user will click a link and it will pop up a "File Download" box to the user instead of displaying actual content. This is very easy and can be achieved using an HTTP header in your HTTP response. For example, if you want make a Filename file downloadable from a given link then its syntax will be as follows.
#!/usr/bin/perl # Additional HTTP Header print "Content-Type:application/octet-stream; name = \" FileName\"\r\n"; print "Content-Disposition:attachment; filename = \" FileName\"\r\n\n"; # Open the target file and list down its content as follows open( FILE, "<FileName" ); while(read(FILE, $buffer, 100)){ print("$buffer"); }
HTML Text Links
HTML Text Links
Links are found in nearly all web pages. Links allow users to click their way from page to page. HTML links are hyperlinks. You can click on a link and jump to another document. When you move the mouse over a link, the mouse arrow will turn into a little hand. The link text is the visible part Clicking on the link text will send you to the specified address.
HTML Link Syntax
Hyperlinks are defined with the HTML tag:
<a href="url">link text</a>
Example
<from action="server url" method="get|post"
<a href="https://www.w3schools.com/html/">Visit our HTML
tutorial</a>
Linking Documents Anchor Tag
Linking Documents
The HTML anchor tag defines a hyperlink that links one page to another page. It can create hyperlink to other web page as well as files, location, or any URL. The "href" attribute is the most important attribute of the HTML<a> tag. and which links to destination page or URL. The href attribute is used to define the address of the file to be linked. In other words, it points out the destination page. The syntax of HTML anchor tag is given below.
Synatx
<a href = "Document URL" ... attributes-list >Link Text </a> </p>
Example
<!DOCTYPE html> <html> <body> <p>Click following link</p> <a href = "http://www.risingquotes.com" target = "_self">Rising Quotes</a> </body> </html>
Output
Click following link
Rising QuotesLinking to a Page Section
Linking to a Page Section.
Linking to a Page Section is also known as bookmark. HTML bookmarks are used to allow readers to jump to specific parts of a Web page. Bookmarks can be useful if your webpage is very long. To make a bookmark, you must first create the bookmark, and then add a link to it. When the link is clicked, the page will scroll to the location with the bookmark.
Example
First, create a bookmark with the id attribute:
<h2 id="C4">Chapter 4</h2>
Then, add a link to the bookmark ("Jump to Chapter 4"), from within the same page:
<a href="#C4">Jump to Chapter 4</a>
This will produce following link, where you can click on the link generated Jump to Chapter 4 to reach to the particular chapter.
Jump to chapter 4nt notranslate prettyprinted"> Jump to chapter 4