HTML Links
<a>
The anchor tag <a> is used to create hyperlinks in HTML. It allows users to click and navigate to another webpage, a section on the same page, an email address, or a file.
Syntax:
<a href="URL">Link Text</a>Example:
<a href="https://www.example.com">Visit Example</a>Output:
Default Link Styles
Web browsers apply default colors and styles to hyperlinks unless customized with CSS.Example:
<a href="https://example.com">Default Link</a>Output:
By default, web browsers display hyperlinks with built-in colors and underlines:
- An unvisited link is underlined and blue.
- A visited link is underlined and purple.
- An active link is underlined and red.
<a> (anchor tag) Attributes
target Attribute - it is used to specify where linked coument will open
Common values:
- target="_blank" - opens the link in a new tab
- target="_self" - opens in the same tab (default)
- target="_parent" - opens in the parent frame
- target="_top" - opens in the full window
download Attribute - it is used to make the browser download the target file once the user clicks the link, rather than displaying it in the browser.
- <a> href=“image.jpg” download></a>