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 trial

CSS CSS Layout Basics Getting Started with CSS Layout Layout Wrapper Challenge

John Levy
John Levy
1,451 Points

I am having trouble with linking my CSS code up with my HTML code. Right now I am using notepad ++.

I cannot link my CSS code with my HTML code. I am using notepad ++. When I open a new document how do I link them so when I refresh the page the CSS changes are shown

index.html
<!DOCTYPE html>
<html>
<head>
    <title>Getting Started with CSS Layout</title>
    <link href='https://fonts.googleapis.com/css?family=Varela+Round' rel='stylesheet' type='text/css'>
    <link rel="stylesheet" href="page.css">
    <link rel="stylesheet" href="style.css">
</head>
    <body>
        <header>
            <h1>Best City Guide</h1>
        </header>

        <div class="main">
            <h2>Welcome!</h2>
            <p>Dessert toffee chocolate lollipop fruitcake cake sweet. Pudding cotton candy chocolate pudding liquorice jelly marzipan. Muffin gummies topping lollipop. Caramels chocolate cake donut liquorice.</p>
            <p>Cake sesame snaps sweet tart candy canes tiramisu I love oat cake chocolate bar. Jelly beans pastry brownie sugar plum pastry bear claw tiramisu tootsie roll.</p>
        </div>

        <footer>
            <p>&copy;2015 Residents of The Best City.</p>
        </footer>
    </body>
</html>
style.css
/* Complete the challenge by writing CSS below */

did you add type="text/css" attribute to all the link tags? and how is your folder stack. usually it has to call the file within the css folder <link rel="stylesheet" type="text/css" href="css/page.css" />

John Levy
John Levy
1,451 Points

Thanks for your reply. How do I go about adding type="text/css" attribute to all the link tags? Right now I am following the tutorials and moved onto the CSS tutorials and they show two codes one that is html and one that is CSS but I cannot see or maybe I missed a part where it explains how the two are combined.

Chase Lee
Chase Lee
29,275 Points

If adding that was your problem, then I think it should look like this:

<link rel="stylesheet" type="text/css" href="page.css">

2 Answers

Chase Lee
Chase Lee
29,275 Points

Are you having problems with a challenge or an actual project you're working on?

Rohit Tolawat
Rohit Tolawat
8,277 Points

Hi, You are adding css in the link tab... that is fine. But are the .css and .html files in the same folder ? If not, keep them in the same folder and you ll be able to link the same.

Regards, Rohit.

John Levy
John Levy
1,451 Points

Thanks for your replies. I just missed the basics where they explain how to link css with the html when I was having issues so figured it out now, thanks again for your help