Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

division background image

Status
Not open for further replies.

Eyespi20

Technical User
Jan 14, 2004
296
0
0
US
I'm trying to create a floating division within my page that has a background image in it. I've got coding in the css page that goes like:
Code:
div.txt{
position:absolute; 
top:250px; 
left:175px; 
height:400px; 
width:70%; 
font-family:Bacon, Arial; 
font-size:14pt; 
color:#4d4f33; 
text-align:left; 
z-index:4; 
background-image:URL(/BG/images/bg1.jpg);
}

however, it's not working properly.

So far, I'm only trying to view this in IE as that's the browser of choice of over 98% of my visitors, but will try to view it in other browsers going forwards.

This is my first attempt at coding a background image in a floating division, so any insight as to what I've done incorrectly will be greatly appreciated.

My body also has a tiled background image which is working properly.

Margaret
 
The obvious question here is, what is "not working properly"? If you fill us in on that, we'll probably know what is wrong, but if you don't tell us how it behaves, we can just be stumped.
 
It's not displaying the background image at all.

I've double checked the path and it's correct, so wondered if it's an error in my syntax.

Thanks,

Margaret
 
try this:

Code:
background-image:url('/BG/images/bg1.jpg');
 
Thanks, Andeee. I got it sorted out.

Margaret
 
Could you please share the solution with us here so that it can help somebody else in the future? Thanks
 
Oh dear -- I'm embarrassed to share it --

the image was a gif, not a jpg, so the PATH was correct, but the file name was not:\

Margaret
 
Incidentally, you really should specify a generic font-family, in case the user has neither Bacon or Arial installed:

Code:
font-family: Bacon, Arial[!], sans-serif[/!];

This applies to all font declarations.

Hope this helps,
Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top