![A Simple Guide for Beginners](https://webcube360.co.uk/wp-content/uploads/2024/01/html-a-tag-sm.png)
A Simple Guide for Beginners
- Digital MarketingNews
- January 12, 2024
- No Comment
- 89
[ad_1]
What Is an <a> Tag in HTML?
An HTML <a> tag is a chunk of code for including hyperlinks from one net useful resource to a different. Additionally it is often called an anchor tag or anchor ingredient.
An <a> tag appears like this:
<a href="https://www.semrush.com">Our homepage</a>
Assets that <a> tags can hyperlink to incorporate webpages, e mail addresses, photos, and movies.
If the <a> tag creates a hyperlink from one useful resource to a different on the similar web site, that hyperlink is known as an “inside hyperlink.”
But when the <a> tag creates a hyperlink from one useful resource to a different on a totally different web site, that hyperlink is known as an “exterior hyperlink.”
Hold studying to be taught extra about HTML <a> tags—together with their advantages. And how one can detect any technical points with yours.
Web sites use anchor tags in HTML anyplace they wish to hyperlink to a different useful resource. HTML stands for “Hypertext Markup Language.” It’s one of many languages net builders use to create webpages.
For instance, this Semrush article on content editing tools hyperlinks readers to the SEO Writing Assistant device:
![SEO Writing Assistant tool link in Semrush blog](https://static.semrush.com/blog/uploads/media/39/0c/390c85a81ce839ebb310b4fc137c9c3e/b4100ff27bf64031399402d343e56776/mwzWBePT8EPsvYpV0Lwvpx6RQcbgCfLoR9ASKf9dKvTHfQhs9xFHsC-K-Ypzy-jk1hAMkSZRLgtju0pHJ89Ht67zXaDTLyyBHeM93DZ31SoIIBVlm-_umU-YQ-5rubPRQ0cJwd6z3sqEFxvZwcfPi_U.jpeg)
Whereas the header menu of Bokksu’s on-line retailer has HTML anchor elements linking to the model’s numerous product and reward card choices:
![Bokksu’s online store header menu](https://static.semrush.com/blog/uploads/media/92/cf/92cf6e1f515404276e63d49f6ae01a87/9210e85477215ee570bfb4c11a4d0770/Cw8JdVV3WeK2-6f2C9TKIJKGaMtItB0wcltop07WfzzcnLRr4_Ofv_mP5rKeKclIoRwAigjieMfBLbZ6EaWTJvzaYHm3UzkG-FC1g3pAZbMI482NhOkCqXUC_4Y1tnfw3h4UBhU8YjbDqcx8hCsaonk.jpeg)
And take a look at the desk of contents for this text.
It accommodates anchor tags that assist readers who click on them “leap” to totally different article sections.
The site owners of the above pages added their HTML anchor tags to textual content.
However you possibly can add HTML link code to pictures, too.
For instance, clicking the picture of a black widow on the Nationwide Geographic Children invertebrates web page leads customers to the group’s info web page on black widows:
![HTML link code added to an image of a black widow on the National Geographic Kids](https://static.semrush.com/blog/uploads/media/67/55/67558b1d94ae1ca5d2efb7bd683d9791/ee69e9a09fb55a778842de711e2ca4a8/BmuLp-d-g_0VKTVJK4ZMbnJJQDLrTWFLdNUtkBy8Y4xkgyMDjnqeXIU4uxWRqQgbPxM74lJEOwPosjtyrfQRS85tED0f7LMLApY3We_AjUw2cowncCdJI-0ddcs2Xs4HxAuRYYp1XhHUEreoQjWPDFI.jpeg)
Elements of an HTML <a> Tag
An <a> tag has 4 parts:
- The opening tag: Which signifies the beginning of the <a> tag
- Tag attribute and attribute values: Which state the web page the tag hyperlinks to. And have an effect on how the tag behaves when customers click on it. We evaluation frequent <a> attributes under.
- Anchor textual content: The textual content customers click on to go to the hyperlink
- The closing tag: Which is “</a>” and signifies the tip of the <a> tag
![HTML <a> tag components](https://static.semrush.com/blog/uploads/media/de/d5/ded5001486d46a289ea48d0c34c5c799/e60e418f0fe8cc50c161722e438a750f/7-rrTGhpRfetZJLBAWz9ulsf97C56EhZK56Wb5hQBvO3bfYdsg8FxmPuQFjXqvnvru1N6RnT3JRL4xYCuwHem6eGdnhHvdA_P_sD4SxsqNuhjz5UqgOA9TlKlY7BAc9omhCee3Qqob-GstB2Qdm4HJ8.png)
<a> Tag Attributes
Listed below are some frequent HTML <a> attributes:
Href
“Href” stands for “hypertext reference.” It states the useful resource the <a> tag ought to hyperlink to.
So, on this “a href link” instance:
<a href="https://www.semrush.com">Our homepage</a>
The “href” attribute has a worth of “https://www.semrush.com.” Inflicting customers who click on the hyperlink to go to that web page.
In contrast to different <a> tag attributes, utilizing the “href” attribute in your <a> tag is obligatory. In any other case, the hyperlink won’t work.
As a result of it doesn’t include info on its supposed vacation spot.
Rel
“Rel” is brief for “relationship.” It states the connection between the present useful resource and the one it hyperlinks to.
Right here’s an instance of an HTML <a> tag with a “rel” attribute:
<a href="https://www.amazon.com/headphones" rel="sponsored" >Store headphones on Amazon (affiliate hyperlink)</a>
The worth of this “rel” attribute is “sponsored.” Indicating that the web page it hyperlinks to (i.e., “https://www.amazon.com/headphones”) is a paid commercial or sponsored content material.
Different “rel” attribute values embrace:
- Nofollow: Tells search engines like google to not cross “hyperlink juice” from the present web page to the one within the <a> tag. (More on the passing of “link juice” later.)
- Noopener: A safety measure that forestalls the linked useful resource from taking management of the present web page when customers click on a hyperlink that opens in a brand new tab or window. So the linked useful resource can’t redirect customers to a phishing rip-off or different unsafe pages.
- Noreferrer: Prohibits the linked useful resource from figuring out the present web page as a supply of tourists for it. Such that net analytics companies like Google Analytics (GA4) will categorize these guests as “direct site visitors” of their experiences. As a substitute of categorizing these guests as “referral site visitors” and naming the present web page as a referral supply. “Noreferrer” additionally brings in regards to the results of the “noopener” attribute even when the <a> tag doesn’t have it.
A single “rel” attribute can include a number of values.
Check out this hyperlink on the SparkToro weblog, for instance:
![A link highlighted link on the SparkToro blog](https://static.semrush.com/blog/uploads/media/4f/85/4f851bf1be94e748073443dee728dabe/66c3b56cf75d13c540666c62edf11a12/3DQskwsrOYSMxOGv7nsDQc2UvIPiAkSspNb0XqEn7MbcVTyBv1sgM3qzR6KeJJ6vZ9p2dzKRNvJZcDbW1bNz_fByfpOYyWdA3ZzjhJYNVY9Ep_2-mrUBWHNPiEi50FxqYhH-DsUWR_AxjEoKkbTcaLU.jpeg)
The hyperlink’s underlying <a> tag has a “rel” attribute of “noreferrer noopener.”
![The above link on the SparkToro blog has a “rel” attribute of “noreferrer noopener"](https://static.semrush.com/blog/uploads/media/d1/af/d1af6127bb6f8a7da059b2a19c4c8480/c1aea72f1a26162d5a80843dd091ddce/7t3h-S4XpMWlaDpt4GKTfsp4utnDhH13hvLuVN7mJ2t96rnHSruCupuu15_8C21S8wjNoB8DVePJukqpabEiu04R_b9rOM1TRaks6O_aEHnL-jNFwhBhjTmgsSCFNK7juDHMNLG_x_G4j18r4AmUWH0.jpeg)
Goal
The “goal” attribute tells the consumer’s browser the place to open the linked useful resource.
One instance of an HTML <a> tag with a “goal” attribute is:
<a href="https://www.semrush.com" goal="_blank">Open our homepage in a new tab</a>
If the <a> tag doesn’t include a “goal” attribute worth, it’ll default to a “goal” attribute worth of “_self.” Which opens the linked useful resource in the identical body.
A well-liked “goal” attribute is “_blank.” Which opens the linked useful resource in a brand new browser tab or window.
The “a href” tag in HTML is to not be confused with the hyperlink tag.
That is the construction of an HTML <link> tag:
<hyperlink [link tag attributes go here] />
Internet builders use hyperlink tags in a web page’s <head> part to state a useful resource’s “hyperlink,” or relationship with one other useful resource. Like:
- Pages which might be the “grasp copy” of comparable variations of the identical web page—through the use of the canonical attribute
- Pages which might be language and regional variants of one other—through the use of the hreflang attribute
Hyperlink tags don’t have closing </hyperlink> tags; they’re self-closing. That means they’re full tags on their very own and don’t must be closed.
In distinction, net builders use HTML <a> tags in a web page’s <physique> part so as to add “hyperlinks”—or “hyperlinks” for brief—from one useful resource to a different.
Additionally they want to shut every <a> tag with an </a> one.
This desk summarizes the variations between <a> and hyperlink tags:
![Key differences between <a> and link tags](https://static.semrush.com/blog/uploads/media/4d/1a/4d1ada697a8df91df0637616f1d583d9/52af306b83b28677c17b3dc11ccbbbe4/L4jJYBY-iRYFCwlAIlkCv01cNKziFfQTZvmrVW_bOgNvNIWyPeRtLpuW9YvdRNK3gv2WgA8Irp-w8Ss7t_iYbfX_p0Kf_PjGP11p8taqAZ_MKW-VyQi8KWyHkYTdn3DAn7P1XOg3B-PDSkTzM2-GOUo.png)
Additional studying: HTML Tags List: HTML Cheat Sheet
Anchor tags might help you:
Enhance the Person Navigation Expertise
By utilizing anchor tags to hyperlink your web site’s assets collectively, you assist customers uncover different content material inside it.
In methods like:
- Letting customers browse numerous sections of your web site. Within the case of inside hyperlinks in navigation menus.
- Enabling customers to conveniently skip to particular elements of the web page. Within the case of anchor hyperlinks.
- Directing customers to detailed guides to matters you’ve briefly talked about on the present web page. Which is very useful for building content pillars.
- Recommending different pages for customers to take a look at after they’ve completed studying the present one. To encourage customers to proceed interacting along with your web site for longer.
With out you including hyperlinks to your pages in these methods, customers is probably not conscious of them. A lot much less be capable to navigate to them to view their content material.
Move Hyperlink Juice By Inside Hyperlinks
“Hyperlink juice,” or hyperlink fairness, refers to a rise in a web page’s authority within the eyes of search engines like google resulting from one other web page linking to it.
This enhance happens as a result of a hyperlink to a sure web page can symbolize a vote of confidence for that web page’s usefulness. The extra hyperlinks from authoritative web sites a web page receives, the extra hyperlink juice these web sites will doubtless have handed to it.
Consequently, search engines like google could regard that web page as extra authoritative. And rank it greater in search outcomes.
A high-authority web page also can cross hyperlink juice to different pages on the identical web site by linking to them.
![An infographic showing how "link juice" is passed down](https://static.semrush.com/blog/uploads/media/16/ec/16ecf146e16cb13676a76c4c8c08dbe8/1b452e2bf4dc366f29ceff48e597e675/w1Ey0yVFBzDNTNX2cP6ljwTatFUigK7oyWUbpka89pQx9ApoATU3PiRRfkUWLa-SsoJzkE-ABs9RVTdPUtBPBPWdlSohE4UyX7whrTFsKV8C0fbM4-tTwEN5gGipxd6CXM8YWrN3nDsdkM3zNwY34kY.png)
So take this straightforward alternative to spice up your pages’ authoritativeness by including inside hyperlinks out of your high-authority pages to them.
Additional studying: Internal Links: Ultimate Guide + Strategies
Fashionable web site platforms like WordPress make creating HTML <a> tags for hyperlinks easy. With no coding wanted.
The precise steps could fluctuate. However they sometimes contain typing your anchor textual content into the web site platform’s content material editor.
![WordPress content editor](https://static.semrush.com/blog/uploads/media/c3/80/c38042a5283e41a19c17aa8dd392214c/54112f0e30cd80faa00c4084348edfc3/B1AQTBsyfJLgJW9owLz3AwjZ2JOphBYmWC65tDX_XW23tzF14I-d3YDtHIzrZuDLbuhsxJYiGAHOriuiBuCw4XT-B3Ozg54ZN9qOPRKHA-ItmOTWmhhwAXCRC1W5zT9wTqPymeCoWWvxGyxadjoyVQM.jpeg)
Spotlight that textual content.
!["Our Homepage" text highlighted in the WordPress content editor](https://static.semrush.com/blog/uploads/media/03/01/03014e925410538ca72708f24b6d8fa8/380f1b5750606cd04a7843c97df67e11/pUbHcDGID02CmYaYFh2QpBGPxVgFX96JjMdooPwyTBJi2GyM-5XyYhVlYPbqiXMK2YRBOoKGKdmd0fp_5GcK6gbaswrM5trkFCYmslhv-WVh-oc_SS1NkzNoPKH-UdBKImkmTBh4jQtggxsdFBR_JCY.jpeg)
Click on the editor’s “Hyperlink” icon, then sort (or copy and paste) the URL the textual content ought to hyperlink to.
![Linking "Our Homepage" text to "semrush.com" in WordPress editor](https://static.semrush.com/blog/uploads/media/9d/78/9d7888243c1eba4a2f23b3f36badc54b/1f9c424e1a429dc352aa68c8855bb1b3/J8i6M3SXYvEoq6Opw3-CL7IvqvZYrKTYgTBi6XCJdgXA3-AouzvDR7m4CKOdy0dQzHkja0uN6be3UquozJ2Gb0nwjlc4wG2IZU3vyOJxcHJIO1USGJQIQIqVmA07ItoEdjs51mp95aWYBZ-e9O6B9NI.jpeg)
Press “Enter” or “Return” in your keyboard to substantiate.
And that’s it! You’ve created your hyperlink—with out typing its underlying HTML <a> tags your self.
!["Our Homepage" text linked successfully in WordPress](https://static.semrush.com/blog/uploads/media/90/e7/90e79b968544d4340d87797c0b5a5412/3ed73f02bf6df07ca10c799f4c9544a5/g3IySXpzsjrZn2bGEIyJ7xZYMwem1RCIl7Lb68KuNY_AOquMsikYS5RSOapDYBtFEYsAgZydvs22PTiAsKLZWACN_BDrSqaat1e1N9_P8cU7YvA0KSyV4-XOSMH1HL5RdFO2EXG_0KmEK3ph2I_oOlY.jpeg)
Detect HTML <a> Tag Points
A technique of checking whether or not your <a> tags work is to manually click on their related hyperlinks in your web page. And see if the hyperlinks convey you to their supposed locations.
However this technique is unfeasible in case your web site has 1000’s of hyperlinks.
So, use Semrush’s Site Audit device to mass-check your <a> tags as an alternative.
Right here’s how:
Launch the device, enter your web site area, and click on “Begin Audit.”
![Site Audit tool search bar](https://static.semrush.com/blog/uploads/media/77/03/77033c8ac3e418f8978ee4df267ab86a/173b1ac0ffb318d3959802141e12009c/uZ3eEUSZrzvlsvrKZybLKQGQBMXg6kBt4R9yLxzidPYKXXB_caet9Ke2wJQC_UVKW2XWa5CdPUqe3MTR3wGJ65alp8vc8D--Q2I4GXogqO3wOeNe99SkngyMC1E6jxMQ684_7fFDg37AS8R6v0TKgUE.jpeg)
A “Website Audit Settings” window will seem.
Below the window’s “1. Area and restrict of pages” tab, use the “Crawl scope” setting to pick whether or not the device must also verify your area’s subdomains for points.
![“1. Domain and limit of pages” tab in “Site Audit Settings” window](https://static.semrush.com/blog/uploads/media/b3/c9/b3c94b52f1ff187e7a3eff514f1e1773/e2a445d3e871ac92cebe3000127da9cb/_Dil0pzqynFQXk5pWhMl9c5S8B-gmkmEu3QsmCrGfvVUKFeKkJwhE5-PIGwT4kHa7wI6DSrqHmLKOgp6P-5MuC4vAPO0YE5XF7XkOvoEIcUX5AJwL6Hq1iT1aPp_WW7JuBfr8w15onTcKNm3BFKHoEk.jpeg)
Use the “Restrict of checked pages” drop-down to decide on the variety of pages the device ought to verify each time it runs.
!["100" pages set next to “Limit of checked pages” box](https://static.semrush.com/blog/uploads/media/6c/e4/6ce4fb78f630415262a302c816f3890d/31a482859a785a327408e14b3fda7761/cTZmSHfxL-v1x-3d9F6Rn-gZKDqaQSbHXwGlIUU8ONW_lOvIUknqcoB4Z8PBO02lISDLEdOIfIednTO9AZjvk9ooUKdvbBDNNMUU9uUPh5_ZqEvkMvH4cdWHPCUNLO0-IL_vHIbvuzwqahoqzVEYa2s.jpeg)
Go away the “Crawl supply” drop-down setting as “Web site” to have the device audit your complete web site.
!["Website" set next to “Crawl source” box](https://static.semrush.com/blog/uploads/media/45/68/4568771971794b613161260b010770a1/317edd122e05acf3f434d8c657d1de0d/-7c_2kek6SVLOI13bqflQHmgF_MjM6cKjxz569e_syS8PfTfqQDVA4fKbIqr0ujQjB9CN1IP-IyDQRouzwc7khPyPSFtRo89xIMQUl01JV49H27v4NN4GH5Dd7KWfZpjtso-x32jOKTyDAYq_ecN3Q4.jpeg)
Go away the “Ship an e mail each time an audit is full.” checked if you need the device to warn you by way of e mail when it has completed checking your web site.
![“Send an email every time an audit is complete" box checked](https://static.semrush.com/blog/uploads/media/1d/a3/1da33ffee579ba06b90cc3d4332bb4db/674bf4d5f2c84bb6e24f54bc1bb3e2a5/SwVKKMb2UUl7KXTOdR5vi7wlT6becawGPaFN3UtsfKIgC3dKas5z1S8pXBgNE5r23HteA9oI4S6AlYKZ5mfhU_HRXUwG56m2bOoHFdPWD2mZ8ZhUauntWj8Kyrb1W2l_4XybNiaKB7DXEz4HwUjFmUc.jpeg)
When you’d like, you possibly can optionally use the tabs numbered two to 6 to configure your audit additional.
!["Site Audit Settings" tabs](https://static.semrush.com/blog/uploads/media/11/5c/115c8df98dc572925f4143f3e53fe6e5/00d44e061585d0131a06c29437488234/QOWgpFn_Ney48E_lDlVGWtuu5iyOCtcbqVCEy8SVX5mffhHmyfY52WuuYuDvC0xRecQlUUht0m4Vkr8s0gCctFXz5xYj18lEnh1geF7Pwf0NNGDqrMkF4H0f9L34BaSUlN7dFUy1fwan65SnUxRDSp4.jpeg)
Then, click on “Begin Website Audit.”
![“Start Site Audit" button highlighted](https://static.semrush.com/blog/uploads/media/2a/ae/2aae72193eb5611f64250a56872f0d4d/09ff2934f1e92f62e33a85e2c38e27e6/rgBWscSDcOVtn15fcG-mZief95GmxTEn0AVtDUhXVFytHRIIhwyuveQDH-RlPRcyxVQhAOU0q9p1xjvcik8S0iNdkLr9gM_B_PcOWswZMUYCPfBqMWr0Ht2gGejDOJLf1FeWqBS1tvLY8aGa0JPNGcU.jpeg)
The device will begin checking your web site for technical points. When it’s performed, click on your area title to view the device’s report.
!["yourdomain.com" name highlighted on the dashboard](https://static.semrush.com/blog/uploads/media/a6/0d/a60d15d29c53da1f88a77fbdd118168f/f23a1a650c4259fe2ce142b452023a94/uvDHqaJxF8gk996a7lZP4vDW6GcROIy7vIKDBnMLKwW9zrrDMGx9v9VfIAjwFLnuEt4waukRbc8Q71zOPSjOmh1VIKgQZXSlprY01EG1BI8UTLvh9a30LSmFJjgo8p4lS0gPmCtpi8kikq5nKUoZE9Y.jpeg)
Click on the report’s “Points” tab.
![“Issues” tab highlighted in the Site Audit dashboard](https://static.semrush.com/blog/uploads/media/fa/24/fa24b23662ff03c10668473b1ca6cfde/440ed9af2810d1a52d6aa0b35db23332/8gwhOWr0WxVLQp7KVeSGf6P9T93kCDTPCCMlziUd7aYwBcoIaSWmwaWs1C_yYYmQXRBCtvWx3HIU3gyyGjs0kKuYfPYYJEZb9hjty-5ffV7S8a1a9xkLhANDAfwc8YPykGfba7TPr3kSnUvClIcO8fw.jpeg)
If a few of your web site’s inside hyperlinks have defective <a> tags, you’ll see a “# inside hyperlinks are damaged” message within the “Errors” part:
!["12 internal links are broken” message in the “Errors” section](https://static.semrush.com/blog/uploads/media/b7/e9/b7e9b6afdf7b0a9715a435d008376755/58628f5506f15800dccc00f292a129d0/cLmSmCsqNHBaWuJ8WPdhlBHWPfozYihcWYOEADv8K38hy0omnvbEU7T8PhqLEcy3StdZwWaZJNDoj-EbetZ6j3SxZqLwVTqpoQWoeR_h-NnxorWNl8c52DkauyaxS-_6RsdD99LbjdpDvnC1NHBVIBo.jpeg)
Alternatively, if a few of your web site’s exterior hyperlinks have defective <a> tags, you’ll see a “# exterior hyperlinks are damaged” message within the “Warnings” part as an alternative.
!["18 external links are broken” message in the “Warnings” section](https://static.semrush.com/blog/uploads/media/0f/a4/0fa45662634bf11159a1760492bf1fc1/3f94c074e12118b542a449430ab5b64c/6MbJ7UlGmukpkph-pGwMW-B0KpvnEBw0NwvTxUa8wTdZB8a-VBW369MGSDqoYcH6FLS8vHDCFltua-NdbQSx_ZFzdBUFWgJe8Dy8VTMKGPNBobnmE4mxoSplY9hYzRj5hp9wfp7320qu3DUOrRO_aww.jpeg)
Click on both message to view its checklist of broken links.
You’ll see a report of the varied damaged URLs. Plus the URLs of the pages on which they are often discovered.
![A list of 12 internal broken links](https://static.semrush.com/blog/uploads/media/62/68/6268c317e9fd8b3b6f28851b05912df5/85b86a62a9d8de8d9d47326da9e27de0/Z6Th8C_OP74tHSluIU9e97zVF5My-yi8OOf-cqcqbFUN6K2VgP2IJWdQHukw_PkTAv94FPSf6eGRlMrOsdsSgquf6mXyENUSruBA9iLV5W_tvRivwjLToK_gWdB7DLi4HC3r_jXbtVm6Av2MAvv3eck.jpeg)
You’ll be able to then repair every damaged hyperlink in methods like:
- Modifying your webpage to exchange the damaged hyperlink with a working one
- Establishing a 301 redirect to direct customers of the damaged hyperlink to a distinct—and dealing—hyperlink
- Modifying your webpage to take away the hyperlink fully in case you not want it
Aside from figuring out damaged hyperlinks, Website Audit can verify for over 140 different technical points. Together with:
You may also schedule your audits to occur day by day or each week. So that you keep on high of any technical points that pop up.
HTML <a> tags play vital roles in facilitating consumer navigation and enhancing search engine rankings.
They could look difficult. However creating them is straightforward.
And managing them is even simpler.
Merely begin a free trial of Semrush to make use of the Site Audit device. Often verify your web site for damaged hyperlinks. And guarantee your <a> tags work as supposed.
[ad_2]
Source link