PVB
PVB

Reputation: 103

div and background image?

im having a problem regarding using background property with url('location') value with a div element. All browsers do not show the background image for any content written within the div tag.

code:

HTML: body has a div tag with the class = slide. this div tag contains some content and links.

CSS: div.slide { margin: 0 auto; background: url(images/btnslide.gif); }

please help me identify the error. maybe i have misused div tag. please point out the solution for the above problem

thanks in advance

Upvotes: 0

Views: 234

Answers (2)

Tony Bogdanov
Tony Bogdanov

Reputation: 7696

This code should work by default, as everybody said something else is wrong.

Either the height is wrong or the image does not exist.

Which browsers are failing exactly?

If you like you can try writting the CSS with full syntax: background: url(..) top left repeat;

Upvotes: 0

Wex
Wex

Reputation: 15715

You either haven't set the height for your .slide element, or you haven't cleared the floats for the elements inside .slide. Try setting a height or adding overflow: auto if you want to clear the floats inside your <div>.

Upvotes: 1

Related Questions