The <a> (anchor) element creates a hyperlink. Its href is the destination, which can be a URL, a path, an in-page anchor, or a special scheme.
External site
Internal page (relative)
Jump to an element with id="section2"
Send email
Call us
The <a> (anchor) element creates a hyperlink. Its href is the destination, which can be a URL, a path, an in-page anchor, or a special scheme.
External site
Internal page (relative)
Jump to an element with id="section2"
Send email
Call us
<a href="https://other.com" target="_blank" rel="noopener noreferrer">
Opens in a new tab
</a>
target="_blank" открывает новую вкладку, но вам следует добавить rel="noopener": без него новая страница может получить доступ к window.opener и потенциально перенаправить вашу страницу (атака "tab-nabbing"). noreferrer также удаляет заголовок referrer. Современные браузеры подразумевают noopener для _blank, но явное добавление — лучшая практика.
<a href="..." rel="nofollow">Don't pass SEO ranking (untrusted/user links)</a>
<a href="..." rel="noopener">Security: no window.opener access</a>
<a href="..." rel="sponsored">Paid/affiliate link</a>
<a href="#top">Back to top</a>
...
<div id="top">...</div> <!-- the link scrolls here -->
Нажатие прокручивает к элементу, чей id соответствует фрагменту.
Якоря — это основа навигации в Интернете.
Знание схем href (относительные, абсолютные, фрагмент, mailto/tel), пары безопасности target="_blank" + rel="noopener" и значений rel, релевантных для SEO, необходимо для правильного и безопасного создания ссылок.