Linking my .HTML to my CSS Having a bit of trouble!?Please Help?

Wesley Kelemen

New member
Ok so ive been working at this for hours..Im trying to link my stylesheet and nothing is happening..Its in the same folder and when i click view source its showing everything is fine...>Can someone take a look at it and tell me whats going on.. Im just using NotePad on Windows 7 and got IE9



<html>
<head>
<link ref="stylesheet" type="text/css" href="sample.css" />
</head>
<body>
<h1> Basic CSS Font Properties</h1>
<p>The following table shows you the basic CSS font properties that allow
you to change the appearance of text in your documents.</p>

<table>
<tr>
<th>Property</th>
<th>Purpose</th>
</tr>
<tr>
<td class="code">font-family</td>
<td> Specifies the font used</td>
</tr>
<tr>
<td class="code">font-size</td>
<td>Specifies the size of the font used</td>
</tr>
<tr>
<td class="code">font-style</td>
<td>Specifies whether the font should be normal, italic or oblique</td>
</tr>
<tr>
<td class="code">font-weight</td>
<td>Specifies whether the font should be normal, bold, bolder, or lighter</td>
</tr>
</table>
</body>
</html>



And heres my style sheet saved as "sample.css"

body {color:#000000;
background-color:#ffffff;
font-family:arial, verdana, sans-serif; }

h1 {font-size:18pt;}

p {font-size:12pt;}

table {
background-color:#efefef;
border-style:solid;
border-width:1px;
border-color:#999999; }

th { background-color:#cccccc;
font-weight:bold;
padding:5px; }

td {padding:5px;}

td.code { font-family:courier, courier-new, serif;
font-weight:bold; }

I am just learning and it could be a simple mistake but without knowing whats going on im stuck.
 
Oh, now i see after about a minute, you're using <link ref=etc. />

It should be <link rel etc./>

With an L.

Thats why it doesn't work
 
The link is incorrect..
You have:
<link ref="stylesheet" type="text/css" href="sample.css" />
it should be:
<link rel="stylesheet" type="text/css" href="sample.css" />

rel not ref. Maybe that is the problem addressed by the other question.

You need to use the validator. You will find both a HTML and CSS validator. It will tell you where you have made errors. Sometimes you need to look above where it locates a problem but in this case it hit right on.

Validators are:
http://validator.w3.org/
and
http://jigsaw.w3.org/css-validator/

Three methods can used: Enter a URI address, Upload a file or direct input (copy and paste)
 
Back
Top