DEV Community

Gustavo Assis
Gustavo Assis

Posted on

LINKS IN HTML.

Hello friends, like always, my name I's Gustavo Assis and I'm a Computer Engeneering studant. I made this articles to help you, and help me, to learn about HTML and CSS.
Today, we will see more about HTML.

LINKS:
I'm talking about The element <link ...> is used to link the HTML file with external resources like stylesheets, fonts, etc.

<link rel="stylesheet" href="./styles.css" />
Enter fullscreen mode Exit fullscreen mode

Stylesheet in one of several arguments, the possible others are:

1. Style and Appearance
stylesheet → Imports an external CSS file.

alternate stylesheet → An alternative style sheet that the user can choose to apply.

2. Site Navigation and Structure
icon → Specifies an icon for the page (favicon).

shortcut icon → Older variant for favicon (today it’s more common to just use icon).

manifest → A JSON file that describes a web application (PWA).

prefetch → Instructs the browser to fetch a resource in advance.

preload → Preloads resources (CSS, fonts, images, etc.) in a controlled way.

prerender → Pre-renders a page in the background for faster navigation.

prev / next → Links sequential documents (like pages in an article).

canonical → Specifies the canonical URL for SEO purposes.

alternate → Links to an alternate version of the content (e.g., different language).

3. Fonts, APIs, and Data
dns-prefetch → Resolves a domain’s DNS before it’s needed.

preconnect → Establishes an early connection to a server.

modulepreload → Preloads JavaScript modules in advance.

Enter fullscreen mode Exit fullscreen mode

About the fonts, Google provides code with the links in Google Fonts, example:

<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Mozilla+Headline:wght@200..700&display=swap" rel="stylesheet">
Enter fullscreen mode Exit fullscreen mode

An example of icons:

<link rel="icon" href="favicon.ico" />
Enter fullscreen mode Exit fullscreen mode

Top comments (0)