Welcome to Dream.In.Code
Become an Expert!

Join 150,170 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 2,290 people online right now. Registration is fast and FREE... Join Now!




Linking CSS to another page

 
Reply to this topicStart new topic

Linking CSS to another page

michele.martin
27 Aug, 2008 - 09:12 AM
Post #1

New D.I.C Head
*

Joined: 27 Aug, 2008
Posts: 4

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,
User is offlineProfile CardPM
+Quote Post

PsychoCoder
RE: Linking CSS To Another Page
27 Aug, 2008 - 09:31 AM
Post #2

using DIC.Core;
Group Icon

Joined: 26 Jul, 2007
Posts: 9,483



Thanked: 161 times
Dream Kudos: 9075
Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions
Show us the code you're using to add the CSS file to your page smile.gif
User is offlineProfile CardPM
+Quote Post

michele.martin
RE: Linking CSS To Another Page
27 Aug, 2008 - 10:31 AM
Post #3

New D.I.C Head
*

Joined: 27 Aug, 2008
Posts: 4

QUOTE(michele.martin @ 27 Aug, 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,



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;

}






QUOTE(michele.martin @ 27 Aug, 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,



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;

}





User is offlineProfile CardPM
+Quote Post

PsychoCoder
RE: Linking CSS To Another Page
27 Aug, 2008 - 10:38 AM
Post #4

using DIC.Core;
Group Icon

Joined: 26 Jul, 2007
Posts: 9,483



Thanked: 161 times
Dream Kudos: 9075
Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

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

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

User is offlineProfile CardPM
+Quote Post

chili5
RE: Linking CSS To Another Page
27 Aug, 2008 - 02:34 PM
Post #5

D.I.C Addict
****

Joined: 28 Dec, 2007
Posts: 763



Thanked: 4 times
My Contributions
If your using XHTML then you need to use:

html

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


wink2.gif

When you post code, you should use code tags. smile.gif Easier to read.
User is offlineProfile CardPM
+Quote Post

michele.martin
RE: Linking CSS To Another Page
27 Aug, 2008 - 03:51 PM
Post #6

New D.I.C Head
*

Joined: 27 Aug, 2008
Posts: 4

thanks for you help it finally worked
User is offlineProfile CardPM
+Quote Post

PsychoCoder
RE: Linking CSS To Another Page
27 Aug, 2008 - 03:53 PM
Post #7

using DIC.Core;
Group Icon

Joined: 26 Jul, 2007
Posts: 9,483



Thanked: 161 times
Dream Kudos: 9075
Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions
No problem, glad we could help smile.gif
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/9/09 03:06AM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month