CSS Position Unset in IE11

前端 未结 1 655
慢半拍i
慢半拍i 2020-12-07 03:23

I have a megamenu that is absolutely positioned, and as some of its parent elements need to have position:relative, I have to use position:unset on

相关标签:
1条回答
  • 2020-12-07 03:40

    unset means

    If the cascaded value of a property is the unset keyword, then if it is an inherited property, this is treated as inherit, and if it is not, this is treated as initial. This keyword effectively erases all declared values occurring

    In your case, position is not an inherited property so it will always consider initial

    Each property has an initial value, defined in the property’s definition table.

    For position, it's static So you can simply use position:static and it will behave the same as position:unset


    Reference: https://drafts.csswg.org/css-cascade-3/


    To make this more generic you have to either use:

    • property:inherit if it's an inhertied propety
    • property:<initial_value> if it's not an inhertied propety. Then you look at the property’s definition table to find the initial value.

    https://developer.mozilla.org/en-US/docs/Web/CSS/position

    0 讨论(0)
提交回复
热议问题