2 replies [Last post]
oneijack
Offline
newbie
Canada
Last seen: 1 year 23 weeks ago
Canada
Timezone: GMT-6
Joined: 2021-06-23
Posts: 2
Points: 8

I can't seem to link my HTML files to my CSS files. This problem is recent -- I've used CSS files for years with no problems except for syntax errors and other solvable errors. I decided to create a simple HTML program and link it to a CSS file.
Here is my code.

Hello

... and my CSS file

body {background-color:blue;}
p {color:red;}

I've tried to solve the problem with clearing my browser cache and other suggestions, but nothing seems to work.

oneijack
Offline
newbie
Canada
Last seen: 1 year 23 weeks ago
Canada
Timezone: GMT-6
Joined: 2021-06-23
Posts: 2
Points: 8

css problems

I'm sorry, I didn't put my code within code tags so I'll ask the same question again. Here is the HTML code that was missing in my first message.

<!DOCTYPE html>
<html>
<head> 
<link rel = "stylesheet" type = "text/style" href = "csstest.css" />
</head>
<body>
  <p>Hello</p>
</body>
</html>

thepineapplehead
thepineapplehead's picture
Offline
Moderator
Last seen: 31 weeks 5 days ago
Timezone: GMT+1
Joined: 2004-06-30
Posts: 9683
Points: 819

Hi Oneijack, not sure if

Hi Oneijack, not sure if you'll see this message now but hopefully you come back!

Is the CSS file in the same location as the HTML file? And definitely named the same thing you are linking to?

Verschwindende wrote:
  • CSS doesn't make pies