Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialThomas Williams
Front End Web Development Techdegree Student 1,856 PointsI'm having issues importing google fonts into my HTML and CSS files...
Here is a copy of my HTML and CSS. For some reason, when i put this code in, it does not change the font on my page. What am I doing wrong?
HTML:
<head>
<link rel="stylesheet" type="css" href="css/stylesheet.css">
<meta name=viewport content="width=device-width, initial-scale=1">
<link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro" rel="stylesheet">
<title>
Thomas Williams
</title>
<h1>Thomas Williams</h1>
<ul>
<li>Home</li>
<li>Portfolio</li>
<li>contact</li>
</ul>
<img src="images/responsive-layout-profile.png" alt="profile picture">
<p>Hi! Im a front-end developer who loves responsive design and css. I recently finished learning front-end web development at Treehouse and am excited to put all my skills to use!</p>
</head>
CSS:
body {
font-family: 'Source Sans Pro', sans-serif;
}
2 Answers
Martin Zarate
10,723 PointsA few issues I can see: first you have some HTML code in the head section of the page. Second, and the reason why the font isn't working is that your stylesheet is listed first on the page, in your CSS you are telling the browser to use the Google font, but the browser can't find it because it hasn't loaded it yet, simply place your CSS after the Google one:
<head>
<meta name=viewport content="width=device-width, initial-scale=1">
<link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro" rel="stylesheet">
<link rel="stylesheet" type="css" href="css/stylesheet.css">
<title> Thomas Williams </title>
</head>
<body>
<h1>Thomas Williams</h1>
<ul> <li>Home</li> <li>Portfolio</li> <li>contact</li> </ul>
<img src="images/responsive-layout-profile.png" alt="profile picture">
<p>Hi! Im a front-end developer who loves responsive design and css. I recently finished learning front-end web development at Treehouse and am excited to put all my skills to use!</p>
Martin Zarate
10,723 PointsCan we see the whole CSS file? I assume you have other styles overriding the 'body' font, ex: 'div' or 'p' tags.
Thomas Williams
Front End Web Development Techdegree Student 1,856 PointsThat's all the css I have so far
Thomas Williams
Front End Web Development Techdegree Student 1,856 PointsThomas Williams
Front End Web Development Techdegree Student 1,856 PointsThat makes sense but, I think i am still doing something wrong. It's still not working right This is what i have: