Div display:initial not working as intended in ie10 and chrome 29

后端 未结 2 1755
逝去的感伤
逝去的感伤 2020-12-04 01:36

I want to display a div with the following restrictions:

  • automatically hide under 1024px width
  • can be toggle by button under 1024px width, but if I cli
2条回答
  •  孤城傲影
    2020-12-04 02:21

    initial does not mean "the default value of a given property for a given element". It means "the default value of a given property as defined by the spec". The initial value of display is inline, not block, as stated here. This is regardless of what sort of element you apply it to. And as already mentioned, IE does not support the initial keyword.

    If you want an element to be displayed as a block, use display: block. If you want it to be displayed inline, use display: inline. If you want it to use whichever is the browser default for it, do not set the display property at all.

提交回复
热议问题