When would I link a url as a stylesheet? How does a url act as a stylesheet?


#1

When would I link a url as a stylesheet? How does a url act as a stylesheet?


FAQ: Learn CSS Selectors Visual Rules - CSS Setup Selectors - Linking the CSS File
FAQ: Learn CSS Selectors Visual Rules - CSS Setup Selectors - Linking the CSS File
#2

an url doesn’t act as a stylesheet, but we can use an url or path for the href attribute of <link>, to load a stylesheet from another website (which then often is a CDN)

For example bootstrap offers CDN (content delivery network) so if we need bootstrap we could just do:

<link rel="stylesheet" heft="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css">

now we can use bootstrap.

the url could also be a relative or absolute path of a css file on the same machine/computer/server, although its then more often referred to as a path, not an url. But programmers sometimes are a bit loose on the terminology.