Web888.vn
  • Shop
  • Blog
Đăng nhập
  • Đăng nhập / Đăng ký

Please enter key search to display results.

Home
  • HTML programming
  • Technology News
The a tag in HTML and the attributes of the commonly used a tag

The a tag in HTML and the attributes of the commonly used a tag

  • 24-07-2022
  • Trung Minh
  • 0 Comments

In this article, I will show you how to use the a tag in HTML to create a link ( link ) in a web page.

The a tag plays a very important role in a website, it is used to create links to link the website together. Take a look at the structure of this site, I've created a lot of links, each of which will point to lessons on the freetuts.net site itself.

In addition, you can also create links to any other website, which are links that you find useful for readers.

Mục lục

  • What is the a tag in HTML?
  • Attributes of the a tag in HTML
  • The title attribute of the a . tag
  • The rel attribute of the a . tag
  • The target attribute of the a . tag
  • The download attribute of the a . tag
  • The href # value of the a tag in HTML
  • The states of the a tag in HTML

What is the a tag in HTML?

The a tag in html is used to create links, ie the links of a certain website on the internet.

If you learn about SEO, you will see that the a tag plays an important role when you go backlinks. We have two types of links, which are internal links ( internal links ) and outbound links to other websites ( external links ). Internal links are links that only link to pages within the domain, while outbound links are links that point to websites that are not the current domain.

The syntax to create a link with a tag is as follows :

 <a href="https://web888.vn">web888.vn</a>

Where href is the path to the website you want to point to.

Example : Create a link with the content of learning javascript , pointing to the link https://web888.vn/hoc-javascript .

 <a href="https://web888.vn/hoc-javascript">học javascript</a>

Attributes of the a tag in HTML

Next I will introduce some of the most commonly used attributes in a tag.

The title attribute of the a . tag

The title attribute is used to describe the meaning of the link. When you hover over the link, a text will appear, which is the content that we have placed in the title attribute.

 <a href="https://web888.vn/hoc-javascript" title="học javascript tại đây">học javascript</a>

The rel attribute of the a . tag

The average person would be less interested in this attribute. But if you are an SEO person, you will need to pay attention.

The rel attribute is used to tell search engines whether to detect this link or not. It has two values as follows:

  • follow is there
  • nofollow means undetected

Example : Declare search bots to not access the link in the example above.

 <a href="https://web888.vn/hoc-javascript" rel="nofollow">học javascript</a>

The target attribute of the a . tag

When you click on the link, the browser will redirect to the destination page immediately and right on the current tab. If you want to go to another tab, you can use the target attribute.

  • _blank , it will specialize the link on a new tab
  • _self then it will switch the link on the current tab ( default value )
  • _parent then it will redirect the link to the tab that opens the current tab. We also call the parent tab of the current tab
  • _top then it will jump to the current tab and is often used in iframes when you want to exit the iframe and go to the original page.

The download attribute of the a . tag

If you want when you click on a link, instead of accessing that link, the browser will download the content of that link, please declare the download attribute.

 <a href="https://web888.vn/hoc-javascript" download>học javascript</a>

The href # value of the a tag in HTML

When you declare an a tag but do not want to point to a link, set the href="#" value.

 <a href="#">học javascript</a>

In addition, if you want when clicking on the a tag, the browser will move to a certain position in the web page, please do the following.

Step 1 : Set the ID for the location you need to move to. Let's say it's a div tag, and I'll set the id for it like this:

 <div id="moveto"></div>

Step 2 : When clicking on the a tag, it will jump to the div#moveto tag, we will set the following:

 <a href="#moveto" >Đi tới div#moveto</a>

The states of the a tag in HTML

Tag a has four main states:

  • link : No action on link yet
  • visited : Clicked on the link and went to the landing page
  • hover : Move over the link
  • active : Link has been activated

Usually we will combine with CSS to animate these 4 states. This problem I will present in the article CSS format a tag.

So I have finished the tutorial on how to use the a tag, this is a very important tag when building the structure for web pages. I will stop this article here, see you in the next post.

Bài viết liên quan:

Installing PHP and introducing PHP basics
Instructions for using the plugin wp bakery builder (visual composer) to make a landing page
Instructions for installing and activating Office 2013
15 pocket tips in daily life you should know
What is WordPress and why should learn about wordpress?
Install composer use for Xampp on Windows
Guide to debug (debug) when programming C/C++ with Dev C++
Binary integer representation and binary operations
Create Gmail STMP and install for WordPress, Laravel, php…
Install and enable fileinfo extension in PHP 7 linux (centos,ubuntu)
The thing that limits your growth is the relationship you have
10 groups of customers that business people often encounter and how to behave professionally

THÊM BÌNH LUẬN Cancel reply

Dịch vụ thiết kế Wesbite

NỘI DUNG MỚI CẬP NHẬT

Step-by-step guide to installing Microsoft SQL Server and connecting to the database for beginners

Reasons Why People Are Increasingly Inexperienced in Life

PHP Data Types

Table (table) in SQL Server

Basic data types in C

Giới thiệu

web888.vn là chuyên trang chia sẻ và cập nhật tin tức công nghệ, chia sẻ kiến thức, kỹ năng. Chúng tôi rất cảm ơn và mong muốn nhận được nhiều phản hồi để có thể phục vụ quý bạn đọc tốt hơn !

Liên hệ quảng cáo: [email protected]

Kết nối với web888

© web888.vn - Tech888 Co .Ltd since 2019

Đăng nhập

Trở thành một phần của cộng đồng của chúng tôi!
Registration complete. Please check your email.
Đăng nhập bằng google
Đăng kýBạn quên mật khẩu?

Create an account

Welcome! Register for an account
The user name or email address is not correct.

Your personal data will be used to support your experience throughout this website, to manage access to your account, and for other purposes described in our privacy policy.

Registration confirmation will be emailed to you.
Log in Lost your password?

Reset password

Recover your password
Password reset email has been sent.
The email could not be sent. Possible reason: your host may have disabled the mail function.
A password will be e-mailed to you.
Log in Register
×