STEP 1) The instructions say to copy and paste in this line: as the first item in the between the head tags…
link href=‘https://fonts.googleapis.com/css?family=Nunito:400,300,700’ rel=‘stylesheet’ type=‘text/css’
(with angle brackets at beginning and end)
STEP 2) Then it says to “Integrate the fonts into your CSS” and provides this:
font-family: ‘Nunito’, sans-serif;
“STEP 1” is easy enough.
The existing reference to my style sheet is not in the head and looks like this:
in “STEP 2” the style sheet is called generic.css and contains this:
Questions a) Where do I put the name of the style sheet in STEP 1?
b) How to integrate the font instructions in STEP 2
The Google instructions example is pretty different to mine.
i didnt write the styel sheet amd a bit of a copy and paster merchant
In your html page add the style sheet between the head tags as shown below. I am assuming you are using an external style sheet. If not then your styles will go between style tag with are contained within the head tags.
If your style sheet does not reside in a folder entitled css then leave off the css/.
To use the font style just add it to whatever tag you want to style with that font in your generic.css style sheet. For example, if you want to style your h1 tag, the do the following:
According to what I know @font-face is only used when using Font Squirrel’s font generator, which I have never attempted to use. I have always used google fonts as described above and shown below from one of my style sheets:
I probably should have changed more things like weight and font size, but knowledge is lacking. But working fine
Can someone please tell me what the main font this site is using? http://www.pacificpc.com.au/about/
Their code refers to Lato ( Google Fonts ) but on checking Lado it is different.
Anyone? Many thanks.
OK I see there is also Open Sans, Indie flower and Oswald
The one I want is Open Sans. If I replace Nunito with say, Indie Flower in the line in the head of the page and in the style sheet that font appears on the page. But if I replace - in those two places - with Open Sans, the page shows the default Times New Roman. sigh… What to do…?
It’s good to know how web fonts work. I always applaud curiosity. However, google makes is so that you don’t really have to.
So functionally all you need to know is :
Go to ‘quick use’ step #3, select the ‘standard’ tab ( this is the default, so you actually don’t need to click anything), and COPY the info in the box below the line ‘3. Add this code to your website:’ then PASTE it anywhere within the HEAD element in your page.
Now anytime you want to use the font all you have to do is , IN YOUR OWN STYLE SHEETS, add the declaration font-family: and the name of the google font ( I also recommend you add a coma separated list of whatever web safe fall back fonts you chose). do remember that if the font name is two words it need to be enclosed in commas. e.g: ‘new sans’
Thank you, Sam. On the Google page it gives 3 methods, the “link” method is shown as standard while the @import is shown as another way, and the javascript method a third way??
The article linked in that answer goes into more detail about link Vs @import, interesting.
I should have said “Open+Sans in the link or @import”.
I mentioned @import because that is a setup I’m using. I put the @import in the global css once, instead of a link on every page. I did not consider performance, thinking the font was just another request either way, so @import seemed the DRYer method, in keeping with the purpose of a global css.