#HTML
#alink
#HTML / a / Creating links
Links are made up of <a> tags. Link targets can be web pages, files, emails, and the like.
basic grammar
<a href="xxx">Label</a>
The href attribute value contains the address of a web page, image, video, file, etc. It is processed according to the settings of the web browser, such as moving to a web page, running a video player, downloading a file, etc.
TIP
If the href attribute has no value, like <a href="">Label</a>,
a link is created that navigates to the current page.
main attribute
There are several attributes that can be added to the a tag. The main attributes commonly used are:
target
The target attribute determines where the link will open.
- _self: Handles links on the current page by default.
- _blank: Process the link in a new window or new tab.
- _parent, _top: Used when the web page is set to a frameset.
download
Add download to download links regardless of web browser settings. for example
<a href="image.jpg">Go</a>
View the image.jpg file in a web browser, but
<a href="images/image.jpg" download>Go</a>
will download the image.jpg file.
Link to a specific location within the document
Prefixing the value of the href attribute with # navigates to the element with the corresponding id. for example
<a href="#result">Go to result.</a>
will go to the element that has result as the value of its id attribute. If it's some other document than the current one, for example an element in an a.html document, do:
<a href="a.html#result">Go to result.</a>
Hyperlink to email address
A hyperlink to an email address looks like this:
Contact <a href="mailto:admin@codingfactory.net">Admin</a>
Clicking on the link will run your email program.
#html #alink #html alink #html a #link #Link to a specific location within the document #Hyperlink to email address #html download #html target
'HTML' 카테고리의 다른 글
[HTML] HTML / caption / tag to attach caption to table (table) (0) | 2022.08.20 |
---|---|
[HTML] Create HTML/table, thead, tbody, tfoot, th, tr, td/table (0) | 2022.08.20 |
[HTML] HTML / pre / tag to output as you type (0) | 2022.08.12 |
[HTML] HTML/em, strong/highlight text, important text (0) | 2022.08.12 |
[HTML] HTML/q, blockquote/quote (0) | 2022.08.04 |