16

I'm wondering what the correct way to reset/unset the CSS behavior property is for IE.

div { behavior:url(fixIE.htc); }

I need to reset this for some specific elements. I started searching for the answer after I noticed that this does not work:

.my-div { behavior:0; }

I found an SO post that says an empty string worked, but there's no reference cited that this is in fact the correct way to do it:

.my-div { behavior:''; }

However, I've seen this used in some code I've come across:

.my-div { behavior:none; }

I cannot find any actual reference as it's not really in the spec, the closest thing I found was here:

http://reference.sitepoint.com/css/behavior

...but it doesn't clarify the issue.

Which way is correct, or does it not matter (consider javascript interaction as well, if it makes any difference)? Please include a reference if it exists - that's what I'm really looking for.

Community
  • 1
  • 1
Wesley Murch
  • 101,186
  • 37
  • 194
  • 228
  • 1
    Wow, I don't miss these days... IE6... IE7... IE8... htc files, float bugs, flash players, table based layouts... – Wesley Murch Jun 12 '18 at 13:16

2 Answers2

15

You can check it at the w3c documentation here. As it says, the initial value is none.

scumah
  • 6,273
  • 2
  • 29
  • 44
  • Aha, that's what I was looking for. I knew `''` didn't seem right and I couldn't find anything from the W3C, or anything official about it, I assumed because it was an MSIE thing... Umm, it *is* IE-only right? – Wesley Murch Oct 31 '11 at 12:16
  • IE and Netscape, using something called _Action Sheets_ I think, so, yes, IE-only in practice :) – scumah Oct 31 '11 at 12:22
  • Indeed, not even the current version of the draft scumah linked has a behavior property. – reisio Oct 31 '11 at 14:22
  • What's misleading is that `unset` works in most browsers but then breaks in IE. Here I was chasing what I thought to be an SVG scaling problem with IE. Then I noticed no checkbox appears in IE's dev tools to toggle `unset` and got suspicious... Now using `max-width: none` and it's displaying at the expected size. I realize your answer is regarding `behavior`, but it seems this pattern applies in many situations. – Mentalist May 15 '19 at 08:02
-7

I think the answer to this question lies in the question itself, just set the behavior to unset value:

.my-div { behavior: unset; }

Tested on Firefox, hope that helps.

elbo_01
  • 1
  • 5