PDA

View Full Version : CSS Background - noob question



WarNox
19-02-2010, 08:06 PM
Hey!

I've tried googling this but am yet to find a solution.

I want a background (colour or image) to apply to the whole site and be visible through all the frames, regardless of which page the user is viewing. I tried putting something like:


<style type="text/css">
body
{
background-color:#b0c4de;
}
</style>

in the "index.html" file where all the frames are defined (in the <HEAD> tag) but that doesn't work :)

Thanks for any help!

nate
19-02-2010, 08:38 PM
This code needs to be in each page, rather than in the page defining the frameset.

Alternatively you could put this in a css file and include that in each page.

pcuser42
19-02-2010, 08:41 PM
This code needs to be in each page, rather than in the page defining the frameset.

Alternatively you could put this in a css file and include that in each page.

That would be the better option - it's much easier changing six characters of one file than changing six characters of six(ty) files. ;)

WarNox
19-02-2010, 09:09 PM
Yeah I though of that, but if I do it that way you'll be able to see a break between the frames unless its one solid colour.

pcuser42
19-02-2010, 09:10 PM
Not if the frame border is zero.

WarNox
19-02-2010, 09:26 PM
But yes if my frames are:

AAAAA
------
B|CCC
B|CCC
B|CCC


:)

pcuser42
19-02-2010, 09:33 PM
Hmm, maybe not then.

Erayd
19-02-2010, 11:23 PM
Nothing stopping you including the CSS file in both the frameset document *and* the sub-documents...

nate
20-02-2010, 12:05 AM
Can I ask why you are using frames in the first place? Very uncommon nowadays.

pcuser42
20-02-2010, 08:16 AM
But yes if my frames are:

AAAAA
------
B|CCC
B|CCC
B|CCC


:)

Had a bit of a play around, and yes the frame border can be eliminated (http://www.imagef1.net.nz/files/frames.jpg).



<html>
<head>
<title>Frame Type 1</title>
</head>
<frameset rows="100,*" frameborder=no>
<frame src="frame_files/framein_a.htm">
<frameset cols="200,*" frameborder=no>
<frame src="frame_files/framein_b.htm">
<frame src="frame_files/framein_c.htm">
</frameset>
</frameset>
</html>

WarNox
21-02-2010, 04:23 PM
Can I ask why you are using frames in the first place? Very uncommon nowadays.

I'm not sure, just what I was playing around with. What would you recommend instead of using frames? PHP Tables?


Had a bit of a play around, and yes the frame border can be eliminated (http://www.imagef1.net.nz/files/frames.jpg).



<html>
<head>
<title>Frame Type 1</title>
</head>
<frameset rows="100,*" frameborder=no>
<frame src="frame_files/framein_a.htm">
<frameset cols="200,*" frameborder=no>
<frame src="frame_files/framein_b.htm">
<frame src="frame_files/framein_c.htm">
</frameset>
</frameset>
</html>


I know the border can be eliminated but if the background is not just a solid colour (ie. a gradient) you will be able to see where each frame stops/starts.

pcuser42
21-02-2010, 04:32 PM
I'm not sure, just what I was playing around with. What would you recommend instead of using frames? PHP Tables?

Use PHP or, at the very least, an external Javascript file. I used an iframe once - it didn't work properly in IE. :rolleyes:

WarNox
21-02-2010, 04:40 PM
What about SSI?

pcuser42
21-02-2010, 06:25 PM
That could work too.

WarNox
21-02-2010, 06:34 PM
Oh I mean what do you think is a better solution :) I'm thinking of making a website and wondering what to use.

pcuser42
21-02-2010, 06:36 PM
To be honest I put my navbar in the HTML file itself :blush:

If your server only supports HTML files, then Javascript is all you can use. However, if you don't mind having .php or .shtml files instead, use PHP or SSI. (I'd use PHP as that's what I know. :p)

WarNox
21-02-2010, 07:24 PM
Its my own server so it supports everything :)

Thanks for your input. I'll play around with php.