Header Ads Widget

ad728

HTML Text Link

HTML Text Link

Use of Base Path

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

Hyperlink Example

Click following link

Rising Quotes

Download Link

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

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 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

Linking to a Page Section

Linking 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 4
nt notranslate prettyprinted"> Jump to chapter 4

Setting Link Colors

Setting Link Colors

Setting Link Colors

By using link, alink and vlink attributes of <body> tag you can give colors to your links, active links and visited links

Example

    <!DOCTYPE html>
<html>

    <body alink = "#54A250" link = "#040404" vlink = "#F40633">
    <p>Click following link</p>
    <a href = "http://www.risingquotes.com" target = "_blank">
    Rising Quotes</a>
    </body>

</html>

Output

Click following link

Rising Quotes

Target Attribute

Target Attribute

The Target Attribute

The target attribute specifies where to open the linked document. The target attribute can have one of the following values:

Option Description
_blank Opens the linked document in a new window or tab
_self Opens the linked document in the same window/tab as it was clicked (this is default)
_parent Opens the linked document in the parent frame
_top Opens the linked document in the full body of the window
targetframe Opens the linked document in a named targetframe

Example

    <!DOCTYPE html>
<html>

   <body>

<p>Click any of the following links</p>
    <a href = "http://www.risingquotes.com" target = "
    _blank">Opens in New</a>
    <a href = "http://www.risingquotes.com" target = "
    _self">Opens in Self</a>
    <a href = "http://www.risingquotes.com" target = "
    _parent">Opens in Parent</a>
    <a href = "http://www.risingquotes.com" target = "
    _top">Opens in Body</a>


    </body>

</html>

Output

Click any of the following links

Opens in New Opens in Self Opens in Parent Opens in Body

0 Comments: