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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

background image only shows in IE 2

Status
Not open for further replies.

1DMF

Programmer
Jan 18, 2005
8,795
GB
Hi,

Why does the background image applied to a div not show in anything but IE?

the URL is...


the CSS..
Code:
#advice_but {
    width:300px;
    margin: 0 auto;
    background: url(images/hand1.gif) no-repeat center left;
    padding-left:80px;
}

it's the hand pointing to the button that is missing.

thanks,
1DMF



"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!
 
well I W3c'd the whole CSS file with no errors plus all the other urls for background images are the same and they show ok?

so I can't see how that would be the problem?

But just to humour you, i added them, and still no joy :-(

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!
 
Hi

As a consolation, the hand is not visible neither in other standard compliant browsers like Opera and Safari.

That is because there is no reason to be visible, as the background image has to be visible below the [tt]div[/tt]'s content, and that [tt]div[/tt] has practically no content, so collapses to 0 height.
Code:
#advice_but {
    width:300px;
    margin: 0 auto;
    background: url(images/hand1.gif) no-repeat center left;
    padding-left:80px;
    [red]height: 38px;[/red]
}



Feherke.
 
And the div collapses to 0 height, because you're floating #advice_but and there's absolutely no need to do that. Remove the float, don't add anything to the original code, and the hand is there.

___________________________________________________________
[small]Do something about world cancer today: PACT[/small]
 
dang,

it't that null content 'standards compliant' bug again.

That one always comes and bites me on the ass!

I should have put a border round it to check what was going on - d'oh!

One day i might actually work it out for myself!

thanks ferherke / vragabond.

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!
 
oh and i think you meant '.advice_but' the class not ID vragabond :p

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!
 
I remember it was advice_but, but not sure if it was id or class. And when I saw the ID here, I figured that was it. Anyway, the input field that was floated.

___________________________________________________________
[small]Do something about world cancer today: PACT[/small]
 
I know, just yankin ya chain bud ;-)

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top