Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

CSS CSS Foundations Selectors Class and ID Selectors

melissa brown
melissa brown
4,670 Points

linking CSS

hi im having troubles linking my css page. i just get a blank page with this in the address bar http://port-80-jmj1bwq19t.treehouse-app.com/

not sure what is wrong.

css code

¬¬¬body { padding-top: 50px; text-align: center; }

/* Shapes */

.square, .circle, .ellipse { display:inline-block; margin: 0 15px; width: 200px; height: 200px; background-color: lightcoral; }

.circle, .ellipse { border-radius:50%; }

.ellipse { height: 120px: }¬¬¬

html code ¬¬¬

<!DOCTYPE html> <html> <head> <title>Selector Groups</title>
<link rel="stylesheet" href="css/style.css"> </head>
<body> <div class="square"></div> <div class="circle"></div> <div class="ellipse"></div>
</body> </html> ¬¬¬

3 Answers

Johan Marais
Johan Marais
15,920 Points

Hi Melissa,

With the code you supplied, it looks like you are missing the

<head></head>

element. When linking the Stylesheet also confirm that you are linking to it in the right directory.

melissa brown
melissa brown
4,670 Points

thanks johan,

i have one folder in the file directory. under that folder i have two sheets index.html and style.css. i tried adding type="text/css" to the code but no change . what would be the correct way to link the directory. i am using workspaces.

Johan Marais
Johan Marais
15,920 Points

Hi

When the CSS file is in the root folder you then need to link to it in the root folder.

the href attribute tell where it can find the css file, by adding the css/ before stylesheet.css will make the browser think that there is a file with the name css and look for it in there.

ie

<head>
   <link href="style.css" rel="stylesheet"> 
</head>
melissa brown
melissa brown
4,670 Points

thanks johan !!! i had the values of link href and rel mixed up. works now