6 Replies - 1545 Views - Last Post: 27 August 2008 - 04:53 PM

#1 michele.martin  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 27-August 08

Linking CSS to another page

Post icon  Posted 27 August 2008 - 10:12 AM

I am trying to link my html page to my css page and they don't work at all. I have the link code in the heading and it is linked to the css page.

Do both pages have to be linked to each other for them to work. Tried it both ways but nothing changes.

Was wondering if it had to do with using notepad to do all my work in. I have tried linking a background image to the html page and nothing works at all. Not sure if I am overlook the smallest detail.

Can someone point me in the right direction

Thanks,

Is This A Good Question/Topic? 0
  • +

Replies To: Linking CSS to another page

#2 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1641
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: Linking CSS to another page

Posted 27 August 2008 - 10:31 AM

Show us the code you're using to add the CSS file to your page :)
Was This Post Helpful? 0
  • +
  • -

#3 michele.martin  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 27-August 08

Re: Linking CSS to another page

Posted 27 August 2008 - 11:31 AM

View Postmichele.martin, on 27 Aug, 2008 - 10:12 AM, said:

I am trying to link my html page to my css page and they don't work at all. I have the link code in the heading and it is linked to the css page.

Do both pages have to be linked to each other for them to work. Tried it both ways but nothing changes.

Was wondering if it had to do with using notepad to do all my work in. I have tried linking a background image to the html page and nothing works at all. Not sure if I am overlook the smallest detail.

Can someone point me in the right direction

Thanks,



This is the code for my html page....
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>My first web page</title>

<link rel="stylesheet" href="web.css" type="text/css">
</head>
<body>
</body>

</html>

This is the code for my css page... Didn't know if both links have to be on it.. tried it both ways still not working...


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

body {
font-family: Arial, Helvetica, sans-serif;
font-size: 10pt;
background-image; url(images/dragster.jpg);
background-repeat; no-repeat;
background-position: left top;

}






View Postmichele.martin, on 27 Aug, 2008 - 10:12 AM, said:

I am trying to link my html page to my css page and they don't work at all. I have the link code in the heading and it is linked to the css page.

Do both pages have to be linked to each other for them to work. Tried it both ways but nothing changes.

Was wondering if it had to do with using notepad to do all my work in. I have tried linking a background image to the html page and nothing works at all. Not sure if I am overlook the smallest detail.

Can someone point me in the right direction

Thanks,



This is the code for my html page....
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>My first web page</title>

<link rel="stylesheet" href="web.css" type="text/css">
</head>
<body>
</body>

</html>

This is the code for my css page... Didn't know if both links have to be on it.. tried it both ways still not working...


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

body {
font-family: Arial, Helvetica, sans-serif;
font-size: 10pt;
background-image; url(images/dragster.jpg);
background-repeat; no-repeat;
background-position: left top;

}
Was This Post Helpful? 0
  • +
  • -

#4 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1641
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: Linking CSS to another page

Posted 27 August 2008 - 11:38 AM

This line

Quote

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">


Needs to be removed from your CSS file. Second, if web.css in the root directory of your site? If it's in a folder then it needs to look like

<link rel="stylesheet" href="../web.css" type="text/css">

Was This Post Helpful? 0
  • +
  • -

#5 chili5  Icon User is offline

  • D.I.C Lover

Reputation: 20
  • View blog
  • Posts: 1,144
  • Joined: 28-December 07

Re: Linking CSS to another page

Posted 27 August 2008 - 03:34 PM

If your using XHTML then you need to use:

<link rel="stylesheet" href="../web.css" type="text/css" />



;)

When you post code, you should use code tags. :) Easier to read.
Was This Post Helpful? 0
  • +
  • -

#6 michele.martin  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 27-August 08

Re: Linking CSS to another page

Posted 27 August 2008 - 04:51 PM

thanks for you help it finally worked
Was This Post Helpful? 0
  • +
  • -

#7 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1641
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: Linking CSS to another page

Posted 27 August 2008 - 04:53 PM

No problem, glad we could help :)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1