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" otwiera nową kartę, ale powinieneś dodać rel="noopener": bez niego nowa strona może uzyskać dostęp do window.opener i potencjalnie przekierować twoją stronę (atak "tab-nabbing"). noreferrer również usuwa nagłówek referrera. Nowoczesne przeglądarki implikują noopener dla _blank, ale dodanie go явnie jest najlepszą praktyką.
<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 -->
Kliknięcie przewija do elementu, którego id pasuje do fragmentu.
Linki zakotwiczające stanowią kręgosłup nawigacji w sieci.
Znajomość schematów href (względne, bezwzględne, fragment, mailto/tel), pary bezpieczeństwa target="_blank" + rel="noopener" oraz wartości rel istotne dla SEO są niezbędne do prawidłowego i bezpiecznego łączenia.