Removing inline border styles

Setting an inline border style (element.style.border) works in all browsers. Removing it to allow the normal border styles to return, however, is tricky in Explorer Windows and impossible in Safari.

Test page. Workaround is included.
Reported by ppk.

Explorer 5-6 Windows, Safari | Reported on 10 December 2004.

This site is no longer maintained. I’m sorry, but it’s just too much work for too little return. You can continue to browse old bug reports, though.




Search reports by browser:

Atom RSS

Comments

(Add your own)

1 Posted by Martyn Merrett on 11 January 2005 | Permalink

The same also applies to style.background

If you use:

element.style.background = "";
alert(element.style.background); // IE6 returns 'none transparent scroll repeat 0% 0%'

-----
A working fix:

element.style.background = "";
element.style.backgroundColor = "";
element.style.backgroundImage = "";
alert(element.style.background); // IE6 returns ''

IE6 seems to require explicit information for all possible values, so maybe its not a bug and just fussy!

2 Posted by Steve Clay on 28 March 2006 | Permalink

Martyn's method works in Safari as well, at least for background. You have to empty EVERY background property one by one.