Paths in HTML

You can find links (links) throughout the web. Link allows clicking to switch to another page.

What is the path in HTML

The paths in HTML are hyperlinks. Clicking on it will take you to another document. When hovering over the path, the mouse's arrow icon changes to a hand icon.

Note: The path is not necessarily text, it may be an image or other HTML elements.

Syntax path in HTML

In HTML, the path is defined by the tag

 href = "url"> text for the path 

For example

 href = "https://www.quantrimang.com/html/"> Summary of HTML lessons 

The href attribute is used to determine the address of a specific destination. (Https://quantrimang.com/html/) The text for the path is the part that will be displayed, clicking here will take you to that address.

Note: If you do not use a slash for the subdirectory address, it may create 2 requests to the server. Many servers automatically add a dash to create a request.

Local Link local path

The example above uses the URL for both the website, the internal link (link to the same website) specified by the relevant URL (no need to https: // www.)

 href = "html_images.asp"> HTML images 

HTML path colors

By default the link will appear as follows (on all browsers)

  1. Unused / clicked links (unvisit) are blue and underlined
  2. The path has been visited / clicked on (visit) purple and underlined
  3. The active (red) path is red and underlined

You can change the default color with CSS.

For example

 le> le> 
a:link {
color: green;
background-color: transparent;
text-decoration: none;
}

a:visited {
color: pink;
background-color: transparent;
text-decoration: none;
}

a:hover {
color: red;
background-color: transparent;
text-decoration: underline;
}

a:active {
color: yellow;
background-color: transparent;
text-decoration: underline;
}

Thuộc tính target Target attribute

Thuộc tính target dùng để xác định xem sẽ mở văn bản được liên kết đó ở đâu, có thể là các giá trị sau: The target attribute is used to determine where the linked text will be opened, which can be the following values:

_blank opens in a new window or tab
_self opens at the same window / tab (default)
_parent opens in the parent frame
_top open in the entire window
framename opens in the naming frame (named frame)

The following example opens the text in the new window / tab

 href = "https://www.quantrimang.com/" target = "_ blank"> Access Network Administrator 

If the site is closed in the frame, you can use target='_top' to break the frame.

 href = "https://www.quantrimang.com/html/" target = "_ top"> HTML5 Tutorial 

Path as image

 a href="default.asp"> 
Learn HTML
style="width:42px;height:42px;border:0;">
>

border:0' is added to prevent IE9 (and backwards) from showing the border around the image (when the image is a path).

Path title

The title attribute is used to specify additional information for the element. Information is usually displayed in the form of tooltip when pointing over the element.

 href = "https://www.quantrimang.com/html/" title = "Access HTML learning page"> HTML learning page 

Create bookmark

Bookmarking in HTML is used to make it easier for readers to go to other parts of the site. Bookmarking is useful when the webpage is too long.

You must first create a bookmark and then add the path to it. When clicking on the link, the page will scroll to the address that bookmarked it.

Create a bookmark with the id attribute

id = "C16"> Chapter 16

Then add the path to the bookmark (Go to Chapter 16) from the same page

 Go to Chương 16 

Attach the path to the bookmark (Go to Chapter 16) from another page

 href = "html_demo.html # C4"> Go to Chapter 16 

External path

The external path may refer to the URL or the link associated with the current website. The example below uses the full URL.

 href = "https://www.quantrimang.com/html/default.asp"> HTML Tutorial 

The example below leads to the website in the HTML directory of the same website

 href = "/ html / default.asp"> HTML Tutorial 

The example below leads to the site located in the same directory of the same current page

 href = "default.asp"> HTMLl Tutorial 

Previous article: Style for HTML with CSS

The following article: Images in HTML

4 ★ | 1 Vote

May be interested

  • Elements in HTMLElements in HTML
    the html element usually goes in pairs, including the opening tag, closing tag, and the content inside the two tags.
  • Symbol - Icon in HTMLSymbol - Icon in HTML
    html has many mathematical, technical and monetary symbols that cannot be used to write.
  • How to combine Motion Paths animation effects in PowerPointHow to combine Motion Paths animation effects in PowerPoint
    motion paths in powerpoint are effects that move along a line and we can combine many types of lines together.
  • Common HTML mistakes that you should avoid for better web programmingCommon HTML mistakes that you should avoid for better web programming
    learning html is not difficult, but when running it in the browser, errors often occur. here are common html errors and how to handle them for better web development.
  • How to insert spaces in HTMLHow to insert spaces in HTML
    this tutorial explains how to insert spaces and line breaks in html. because no matter how many times you type a space, html will display a space so to insert more than one space, you will need to use the html tag.
  • Image img in HTMLImage img in HTML
    when you visit the website, you will often see images of all sizes and positions on the page. images in html web pages will help to enrich the content as well as increase the aesthetics of the page.
  • Attributes in HTMLAttributes in HTML
    properties are used to add information to elements in html.
  • The id attribute in HTMLThe id attribute in HTML
    in html, the id attribute is used to specify a unique id for an html element (the value must be unique in the html file).
  • Table in HTMLTable in HTML
    what does it take to create a table in html? is it complicated? want to add color to the table border, how to add the background color to the text in the table? in this article tipsmake.com will answer those questions and guide you to basic operations with tables on html, in addition to adding alternate color schemes for rows in the html table. invite you to follow along.
  • Title in HTMLTitle in HTML
    it is very important to use the title to show the text structure. heading (html) in html is identified by tags marked from to, of which the most important title is the least important.