Click to See Complete Forum and Search --> : Set a image background for <h1>


BOB101
02-18-2006, 03:32 PM
Hi,

I have an image for my h1 in a div. But I don't know how to add it? I know this sounds a little noobie but I do appreciate the help.

Thanks,
BOB101

NogDog
02-18-2006, 03:42 PM
Is it an image that you want as a background behind your title text, or do you want to use the image as the title instead of text?

BOB101
02-18-2006, 03:42 PM
An image behind my text.

NogDog
02-18-2006, 04:03 PM
Here's the applicalbe spec: http://www.w3.org/TR/CSS21/colors.html#background-properties

The usual short-hand method is something like:

h1 {
background: #ffffff url(image.jpg) no-repeat; // change to "repeat" for tiled image
}

Study the link above for all the possible permutations.

BOB101
02-18-2006, 04:21 PM
It didn't work. This is what I have.

#block h1 {
font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
font-size: 12px;
color: #FFFFFF;
background: #FFFFFF url(images/block_subhd.gif) repeat;
margin: 0px;
padding: 2px;
}

This is the pic (http://www.test.zipzapgaming.com/images/block_subhd.gif)

NogDog
02-18-2006, 05:52 PM
Looks like valid CSS. Did you assign an id="block" to the DIV which contains the H1? Is the image actually in the directory called "images" which is a subdirectory of that which contains the web page?

BOB101
02-18-2006, 08:13 PM
NogDog,

I fixed it hours ago, thanks for the code. My problem was that I wasn't given the css the right link to the picture.

Thanks,
BOB101