Removing inline border styles

Atom RSS

This site heavily relies on bug reports created by its readers. Anyone can report a bug and be published.

Main navigation:




Search reports by browser:

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.

Comments

(Add your own)

Posted by Martyn Merrett on 11 January 2005

1

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!

Posted by Steve Clay on 28 March 2006

2

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

Post a comment

Commenting guidelines:

  1. When quoting specs, articles or your own research, please include a URL of the document.
  2. Test your stuff. When reporting browser behaviour, make sure that your report is correct.

Yes