In-line CSS IE hack

后端 未结 7 1361
栀梦
栀梦 2020-12-30 13:33

Is it possible to create, for instance, a box model hack while using in-line CSS?

For example:

7条回答
  •  离开以前
    2020-12-30 13:59

    I'd go outside - slap a class on that element, or use the ID you have, and handle the styling externally.

    I'd also concur with the conditional comments answers preceding mine.

    That said: As an absolute last resort, you can use the following style hacks to target <= IE6, and even IE7. The trouble comes when/if they fix IE8 to defeat your hack.

    .foo {
    padding: 5px;
    ^padding: 4px; /* this targets all IE, including 7. It must go first, or it overrides the following hack */
    _padding: 3px; /* this targets >= IE6 */
    width: 30px;
    }
    

    Good luck.

提交回复
热议问题