Reputation: 390
So I've checked out another question being answered on this and attempted this on my own. I want to use the Lobster two font and I'm not sure what I'm doing wrong.
Here's my code:
HTML:
<!DOCTYPE html>
<html>
<head>
<title>Cogna</title>
<link rel="stylesheet" type="text/css" href="Home.css">
</head>
<body>
<table id="site">
<tr>
<td id="Cogna">Cogna</td>
<td style="border: 2px solid black; border-collapse: collapse;">a</td>
</tr>
<tr>
<td style="border: 2px solid black; border-collapse: collapse;">a</td>
<td style="border: 2px solid black; border-collapse: collapse;">a</td>
</tr>
</table>
</body>
</html>
CSS:
@font-face {
font-family: 'Lobster Two';
src: url("//fonts.googleapis.com/css?family=Lobster+Two");
}
#Cogna {
font-family: 'Lobster Two', Times, serif;
font-size: 5em;
border: 2px solid black; border-collapse: collapse;
padding: 18pt;
width: 20%
}
#site {
border-collapse: collapse;
width: 100%;
}
I know I've asked it to replace with Times New Roman if it can't find the font, but I really want to use the font.
Any help would be great. Thanks.
Edit: this is the exact link to the font: https://fonts.google.com/specimen/Lobster+Two.
Upvotes: 2
Views: 298
Reputation: 463
In the style sheet use
@import url('https://fonts.googleapis.com/css?family=Lobster+Two');
Then where you want to apply the font:
font-family: 'Lobster Two', cursive;
Upvotes: 0
Reputation: 897
2 Method in order to add Google font :
Standard :
Add this in the head of your html file <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Lobster">
CSS:
Apply the family to which ever elements you choose in your style.css file such as:
h1 {
font-family: 'Lobster', cursive;
}
Upvotes: 1
Reputation: 2099
Referencing a link to the font is fine, but downloading the font is preferable. I did mine according to this answer.
Drop in the generated CSS from the page, and reference the CSS file in your HTML like so:
<link rel="stylesheet" href="path/to/styles.css">
Upvotes: 2
Reputation: 40768
Google is friendly enough to give you a step by step guide on how to use their fonts.
More details on their wiki
Upvotes: 1
Reputation: 496
use this in your html file: <link href="https://fonts.googleapis.com/css? family=Lobster+Two" rel="stylesheet">
add this in your css where you want to apply the font there
font-family: 'Lobster Two', cursive;
try this .. good luck :)
Upvotes: 0
Reputation: 1
Try including the font using this:
@import url('https://fonts.googleapis.com/css?family=Lobster+Two');
instead of
@font-face {
font-family: 'Lobster Two';
src: url("//fonts.googleapis.com/css?family=Lobster+Two");
}
Upvotes: 0
Reputation: 156
I think you need to change this
src: url("//fonts.googleapis.com/css?family=Lobster+Two");
into thissrc: url("http://fonts.googleapis.com/css?family=Lobster+Two");
Upvotes: 0