liveBook · Manning

Link element

As explained in Build a Website with ChatGPT

A link element is an HTML element that declares a relationship between a document and an external resource such as a stylesheet.

A link element is an HTML element that declares a relationship between a page and an external resource. Common uses here connect an HTML page to a CSS stylesheet or to web fonts. section 6.2.3 section 6.3.1

A link element can specify:

  • The external file or resource with the href attribute. section 6.3.1
  • The relationship with the rel attribute, such as stylesheet. section 6.2.3
  • A stylesheet file that should be saved alongside index.html when the href names styles.css. section 6.2.3

Connecting a page to CSS

Place this line in the HTML head: <link rel="stylesheet" href="styles.css">. The browser then looks for styles.css and uses it to format the page. Save styles.css in the same folder as index.html unless the href specifies another location. section 6.2.3 section 6.3.1

<link rel="stylesheet" type="text/css" href="styles.css">

Use the copyable stylesheet link as a compact reference for the element’s attributes and file connection. section 6.2.3

How Build a Website with ChatGPT covers it

How deep it goes
Defines href and rel through working snippets, but stops short of browser loading internals.
Examples
Uses styles.css, Google Fonts URLs, index.html, and a generated information website home page.
What it assumes
Assumes only basic HTML file handling and teaches the stylesheet connection through generated code.
What you can do after
Apply it via HTML to connect a page with a stylesheet or external font resource.
How it connects
Connects HTML with CSS, stylesheets, web browsers, and external web fonts.

Also explained in

Compare how 3 books explain link element →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Build a Website with ChatGPT. The section links point to the parts of the book it draws on.