PDA

View Full Version : stylesheet, javascript and general dhtml questions goes here



Peegee
11-05-2004, 03:40 AM
I'll just unload question upon question in this thread as they occur (and trust me they will occur).

Firstly, I'm making a webpage with an external stylesheet. I have a class called .bodyBackground which is supposed to display an image in a specific place and/or change the background colour for the page.

But the image doesn't display


.bodyBackground

background-image:url(http://forums.eyesonff.com/images/smilies/biggrin.gif);
background-repeat:no-repeat;
background-:bou::bou::bou::bou::bou::bou::bou::bou::bou::bou:left top;
background-color:#FCDBE4;
}

I used the same code (not the background-color though) in a html file enclosed in a style tag. I can't use any style tags in the webpage for this assignment (because in the event that I change the style for one page, I'll have to do it for all others, and hypothetically in a webpage of 1000 files with the same style, stylesheet > style).

However nothing changes..... :confused: :confused: :confused: :confused:

Dr Unne
11-05-2004, 04:07 AM
I assume the missing { is a typo when you typed it here and not in your stylesheet.

You are using &lt;sometag class="bodyBackground">content goes here</sometag> right? Otherwise nothing will happen.

If you specify a background image for a tag, that background image won't be displayed if the content of the tag doesn't stretch that tag enough to display the image. In other words if your image is 500x500 pixels, and you say

&lt;div class="bodyBackground">Hi&lt;/div>

and you don't have any other size-related markup for that div, that div will by default be only high enough to fit the word "Hi" in it, and probably take up 100% width of your screen (the default action of divs). But you won't be seeing much of your background image. If this is your problem you can put height: 500px; width: 500px; or something and see if that helps.

Peegee
11-05-2004, 04:20 AM
Yep, that did the trick (put it in a td tag actually). Thanks!

And the background color required a different class on its own. My silly webpage is on its way!

edit: what's a way to refresh the page in mozilla? I have:

[A HREF="javascript:history.go(0)">Click to refresh the page[/A>
[a href="#" onclick="setCookie('style','Fluffy');">Fluffy Puff[/a>

Where 'setCookie' is a function I can use to simply set values for cookies. The point is that 'javascript:history.go(0)' refreshes only in IE but not Mozilla :o

also this isn't really pressing but I'm trying to remember a tag that lets you write any html code and have it show up as text. I *think* it may have started with an 'x'.