Forum Moderators: not2easy

Message Too Old, No Replies

Cannot Get My CSS To Work

         

Tumdace

7:05 pm on Jun 30, 2009 (gmt 0)

10+ Year Member



I have tried for days, to make my .css file link properly to my index.html file with no success.

I have looked around on the net for a solution but I honesty think its not my fault, I think its something to do with something my ISP is blocking.

My HTML header:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Main Page</title>
<link href="Style.css" rel="stylesheet" type="text/css" />
</head>


body {
background-image: url(background.jpg);
background-repeat: repeat;
}.title {
font-family: Georgia, "Times New Roman", Times, serif;
font-size: 72px;
color: #FFFFFF;
}
.subtitle{
font-family: Georgia, "Times New Roman", Times, serif;
font-size: 48px;
color: #FFFFFF;
}

Ive got my index.html, Style.css, and background.jpg file all on the root of my server, but the only thing that shows is my index.html file with no formatting, and the background image does not show up. Any ideas?

[edited by: Tumdace at 7:41 pm (utc) on June 30, 2009]

daveligno

12:01 pm on Jul 2, 2009 (gmt 0)

10+ Year Member



The image path is correct? it is in a protected directory?

In thoose cases, I usually test my page in a specific css editor. In there the document work well, it is surely a server problem. You can use this tool: <>

[edited by: SuzyUK at 12:25 pm (utc) on July 2, 2009]
[edit reason] no URIs per Charter [WebmasterWorld.com] [/edit]

Tumdace

1:46 pm on Jul 2, 2009 (gmt 0)

10+ Year Member



Its a relative link path for the image, all files are in my root directory. Unless there is something fancy I need to do with my background-image attribute?

rocknbil

3:38 pm on Jul 2, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome aboard Tumdace, it **looks** like it should work. Enter into your browser's address bar,

http://example.com/background.jpg

If you can't see the image, it may mean it's been uploaded in ASCII mode. Images, Flash, and other non-text data needs to be uploaded in binary mode.

If you can see the image in that case, go back to the page and hold down the CTRL key (Apple key for Mac) and press F5 (or hit reload/refresh button.) This forces a full refresh of the page, rather than using cached copies. You may have cached a previous broken version of your page. Browsers are selfish when it comes to included CSS and JS files and sometimes keep previous cached files.

If it still doesn't work, this is probably not going to be any different, but you could try

body { background: url(background.jpg) repeat; }

You could try adding a leading slash,

body { background: url(/background.jpg) repeat; }

Shouldn't make any difference though.

Tumdace

5:00 pm on Jul 2, 2009 (gmt 0)

10+ Year Member



I cant see the image with that url, http://example.com/background.jpg

Tumdace

5:14 pm on Jul 2, 2009 (gmt 0)

10+ Year Member



Or did you mean putting in MY ip adress and then /background.jpg?

Cause if I do that, it just shows me the url on the page again.

Oh and its not just my image, its my whole .css file, because the text formatting is not working either.

[edited by: Tumdace at 6:06 pm (utc) on July 2, 2009]

g1smd

2:41 am on Jul 3, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Try
<link href="[b]/s[/b]tyle.css" rel="stylesheet" type="text/css" />
with a leading slash, and rename the file on your server so that the name is all lower case too.

rocknbil

4:05 pm on Jul 3, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Or did you mean putting in MY ip adress and then /background.jpg?

Right, we can't post specific site URL's here so you will see "example.com" a lot. Take it one step further, if you request the URL/URI to your CSS, it should do the same - display your CSS (In FireFox only, it may try to open a "helper" program in IE.)

Cause if I do that, it just shows me the url on the page again.

Say what? You put "yoursite.com/background.jpg" in the address bar and it displays a page that is all white with only the text of the URL on it?

I have seen this in some PHP applications that weren't functioning correctly, I have no other explanation for it. If the above accurately describes the problem, there is something else at play, possible something in an .htaccess directive or server configuration redirecting requests.

Tumdace

11:33 pm on Jul 6, 2009 (gmt 0)

10+ Year Member



So maybe my httpd.conf isnt configured correctly?