All you Need to Know About “a” tag in HTML
Redirecting someone to another page or redirecting content to your webpage is a very good way to keep things interactive. This can be made possible by the “a tag in HTML”. Let’s understand this but first
What are tags in HTML?
HTML tags are like keywords which defines that how web browser will format and display the content. With the help of tags, a web browser can distinguish between an HTML content and a simple content. HTML tags contain three main parts: opening tag, content and closing tag. But some HTML tags are unclosed tags.
When a web browser reads an HTML document, browser reads it from top to bottom and left to right. HTML tags are used to create HTML documents and render their properties. Each HTML tags have different properties.
An HTML file must have some essential tags so that web browser can differentiate between a simple text and HTML text. You can use as many tags you want as per your code requirement.
- All HTML tags must enclosed within < > these brackets
- Every tag in HTML perform different tasks.
- If you have used an open tag <tag> then you must use a close tag <tag> (except some tags)
What is ‘a’ tag in HTML?
A link is specified using HTML tag. This tag is also known as anchor tag and anything inside this opening tag and closing tag becomes the part of the link and the user can just click that part and can reach to that linked content or document. This <a> is the simple tag to use and is as follows:
Options in ‘a’ Tag
You can provide a lot of options in this a tag in HTML. Below are some of them
|_blank||A linked document is opened in a new tab or new window.|
|_self||A linked document is opened in the same frame.|
|_parent||A linked document is opened in the parent frame|
|_top||A linked document is opened in the full body of the window.|
|targetframe||A linked document is opened in a named targetframe.|
|download||To create a link that tells a browser to download a file|
Example for the basic understanding the difference in few options given for target attribute of a tag.
With this, we come to an end of this a tag in HTML article. I hope you understood what an anchor tag is.
Check out our Full Stack Web Developer Masters Program which comes with instructor-led live training and real-life project experience. This training makes you proficient in skills to work with back-end and front-end web technologies. It includes training on Web Development, jQuery, Angular, NodeJS, ExpressJS, and MongoDB