I have made edits because the link to the "previously answered solution" is not helpful.
Find additional information attached at the end of this question
Original Query
All my HTML pages contain two links to external style sheets. As a result, I am looking to consolidate them into one external style sheet.
<!DOCTYPE html>
<html>
<head>
<title>Html Demo</title>
<link rel="stylesheet" type="text/css" href="mystyles.css">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.2/css/all.css" (etc)
...
The current setup runs smoothly. Index.Html
displays some attractive icons:
<p>
<i class="fas fa-fish"></i>
<i class="fas fa-frog"></i>
<i class="fas fa-user-ninja vanished"></i>
<i class="fab fa-facebook"></i>
</p>
However, including the font-awesome link in all my HTML pages is a necessity.
I am considering moving the font awesome reference to MyStyles.css
. What would be the correct syntax for this?
Incorrect MyStyles.Css Attempt:
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.2/css/all.css" (etc)
body {background-color: lightblue;}
h1 {color: yellow; margin-left: 20px;}
... (etc)
What would be the accurate syntax for this operation?
Supplement
This inquiry appears to be answered elsewhere. The answer suggests the following approach:
@import url("base.css");
I appreciate how straightforward the response is. All that is required is relocating the original link to the CSS file.
The initial (working) text in index.html
was as follows:
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.2/css/all.css" integrity="sha384-fnmOCqbTlWIlj8LyTjo7mOUStjsKC4pOpQbqyi7RrhN7udi9RwhKkMHpvLbHG9Sr" crossorigin="anonymous">
Note: there are additional parameters after the reference to the imported CSS file!
Various attempts within `mystyles.css`, similar to the referenced question, unfortunately did not yield the desired results:
(1) Solely importing the css file. Where should the extra parameters be placed?
@import url("https://use.fontawesome.com/releases/v5.7.2/css/all.css");
(2) Including everything within the url statement:
@import url("https://use.fontawesome.com/releases/v5.7.2/css/all.css" integrity="sha384-fnmOCqbTlWIlj8LyTjo7mOUStjsKC4pOpQbqyi7RrhN7udi9RwhKkMHpvLbHG9Sr" crossorigin="anonymous")
(3) Adding the parameters after the closing bracket:
@import url ("https://use.fontawesome.com/releases/v5.7.2/css/all.css") integrity="sha384-fnmOCqbTlWIlj8LyTjo7mOUStjsKC4pOpQbqyi7RrhN7udi9RwhKkMHpvLbHG9Sr" crossorigin="anonymous"
(4) Whereas the original import statement suggested using double quotes, one alternative proposed the employment of single quotes:
@import url ('https://use.fontawesome.com/releases/v5.7.2/css/all.css') integrity="sha384-fnmOCqbTlWIlj8LyTjo7mOUStjsKC4pOpQbqyi7RrhN7udi9RwhKkMHpvLbHG9Sr" crossorigin="anonymous"
(5) According to W3Schools, brackets need not be used whatsoever:
@import url "https://use.fontawesome.com/releases/v5.7.2/css/all.css" integrity="sha384-fnmOCqbTlWIlj8LyTjo7mOUStjsKC4pOpQbqyi7RrhN7udi9RwhKkMHpvLbHG9Sr" crossorigin="anonymous"
Therefore, can anyone provide insight on the right syntax to use?