Background images for DIV

liunx

Guest
I've got an image that I want to use as a background within a DIV tag. I'm not sure if that's possible as such, so my approach is to use layers. I'm not a CSS expert, so I'm having problems getting it to look right.

The DIV is centered horizontally on the page using the CENTER tag. The DIV will have the same WIDTH and HEIGHT as the image itself so that the image fills it entirely.

Then I want some text to be centered within the DIV, but laying on top of the image.

I'm not sure whether I need 2 DIVs, or 1 DIV with the image and text having their own IDs for positioning.

EDIT - here's a URL.... <!-- w --><a class="postlink" href="http://www.c2h2.co.uk/biog.php">www.c2h2.co.uk/biog.php</a><!-- w --> (<!-- m --><a class="postlink" href="http://www.c2h2.co.uk/biog.php">http://www.c2h2.co.uk/biog.php</a><!-- m -->)

Anyone got any suggestions ?

Thanks

Rich<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Content-Style-Type" content="text/css">
<title>Example</title>
<div style="background:fixed no-repeat url(<!-- m --><a class="postlink" href="http://www.bettiepage.com/images/photos/bikini/bikini1.jpg">http://www.bettiepage.com/images/photos ... ikini1.jpg</a><!-- m -->); height:300px; margin:auto; width:139px"> </div>

Do not use the CENTER element. The CENTER element, like the FONT element, is bad.Thats' great Charles.

I also found a thread which helped me to position my image in the center of the page using positioning and margins. So thanks to Stefan for that.

I know it bothers you guys when people miss off the DOCTYPE, but I don't understand what they do and which one I should choose. Can you give any pointers?

Thanks again

Richwell heres a little helpful article for you:

<!-- m --><a class="postlink" href="http://www.alistapart.com/stories/doctype/">http://www.alistapart.com/stories/doctype/</a><!-- m -->

they basically tell the browser how to display your page...Hi, folks!...

I just read this post, and I纾
 
Back
Top