Q:

I can't use CSS code in HTML doc?

I am super new to HTML and CSS and I ran into a problem when I try to link CSS code in HTML. The code doesn't show the background color like it should. HTML Code:
<!doctype html>
   <html>
     <body>
       <link href="styles/main.css" rel="stylesheet" type="text/css"/>
     <body>
   </html>

CSS code:
body {
background: #999;
}

I have them both in the same folder. I am lost and confused so any help would be greatly appreciated! 

A:

CSS files should be included in the head section. If you have them in the same folder you need to change the href aswell.

<!doctype html>
<html>
  <head>
    <link href="main.css" rel="stylesheet" type="text/css"/>
  </head>
<body>

<body>
</html>

A:

You have to use href="main.css"
By using styles/ the browser searches for a folder called styles in the same folders and can't find it so no CSS will be applied

