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 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