- Create Account

PNG Background on HTML Element

Forums > IEPNGFix > PNG Background on HTML Element
Author
Message

1) MacNimble Group: Members
Posts: 1 Joined: 13 Apr 2008 Location: Providence, RI, USA IP: 72.192.--.--
Thought I'd send this along, since I spent so much time troubleshooting it.

I'm working on a webapp for a client (www.pathwaystocompetitiveness.com). I created a logo which they wanted behind the login on the main page. All fine well and good. Because I was using some tricky vertical centering, I was placing the background on the HTML element. Couldn't find anything anywhere indicating this was a bad idea.

There's rounded corners there, which I knew I couldn't get with PNG's (with the trouble with background-position and all). I thought I could at least put the globe behind the normal (non-rounded) window. Because I develop sites using one centralized index and a switching mechanism to include the proper classes and content, I couldn't figure out for the life of me why the PNG was appearing just fine in the masthead within the site, but was not being handled by Angus' IEPNGFix script on the login page.

To make a long story longer, it seems the trouble was the background on the HTML element. Apparently, within the CSS, the HTML element cannot receive a behaviour, which was preventing the parsing.

Quick fix: move the background to the body -- no problem. So, if you're having trouble with PNG's as backgrounds on your site, make sure you're not trying to load it on the HTML element.

Hope it helps.
Bill Brown
TheHolierGrail.com
MacNimble.com

2) Angus Turnbull Group: Moderators
Posts: 4042 Joined: 7 Dec 2003 Location: New Zealand IP: 202.137.--.--
Well spotted :). <HTML> is a no go with this script, <BODY> has troubles for some people it seems, and <DIV> etc are usually quite fine.

- Angus.

3) Bill Brown Group: Guests
IP: 72.192.--.--
Hey thanks!

Awesome script, mate. I've been pilfering code from your site for years now. I always take a moment to delight when one of you Web Gurus responds back to something I've written. It's almost like you're a real person somewhere. Almost. ;)

Thanks  again for the script and the follow-up.
-Bill

Post a Reply:

You are not logged in, and will be posting anonymously as a guest. If you want to post using an account, please login at the top of this page.