Forum Moderators: not2easy

Message Too Old, No Replies

problem with background images from linked style sheet

         

the_styler

4:39 pm on Oct 2, 2007 (gmt 0)

10+ Year Member



i have been having trouble getting the browser to recognise the background-image property when calling in from an external style sheet.

other rules in the external sheet are applied, as are other properties in the rule that holds the background-image call, but it ignores the the background-image for some reason - this is across all browsers i've tried. I have removed any conflicting rules from the document and have tried placing in the head section of the document where it works fine.

can anyone help? i need to include a background image for IE only and attaching an ie specific sheet this is the only way i know!

the code I am using is:

<code> div#topnav, div#mainnav{
background:transparent url(images/overlay.png) 0 0 repeat;
padding: 6px 0;
font-size:10px;
width:900px;}</code>

Drag_Racer

4:50 pm on Oct 2, 2007 (gmt 0)

10+ Year Member



let me take a wild guess that your stylesheet is not in the same folder as your document. urls in the stylesheet are relative to the stylesheet and not the document that called the stylesheet. as a habit I make all urls in my stylesheets absolute paths starting with a forward slash.

so maybe change this

background:transparent url(images/overlay.png) 0 0 repeat;

to this

background: url('/images/overlay.png');

btw.. everything else defined in the statement is the default and declaration is not needed unless it is to override a cascade from earlier declaration.

the_styler

6:26 pm on Oct 2, 2007 (gmt 0)

10+ Year Member



that works great - thanks