Does opacity:0 have exactly the same effect as visibility:hidden

前端 未结 9 1326
予麋鹿
予麋鹿 2020-11-22 11:53

If so, does it effectively deprecate the visibility property?

(I realize that Internet Explorer does not yet support this CSS2 property.)
Comparis

相关标签:
9条回答
  • 2020-11-22 12:35

    The properties have different semantic meanings. While semantic CSS sounds like it may be silly, as other users have mentioned it has an impact on devices like screen readers -- where semantics impact the accessibility of a page.

    0 讨论(0)
  • 2020-11-22 12:38

    No it does not. There is a big difference. They are similar because you can see through the element if visibility is hidden or opacity is 0, however

    opacity: 0 : you can not click on elements behind it.

    visibility: hidden : you can click on elements behind it.

    0 讨论(0)
  • 2020-11-22 12:42

    No.

    Elements with opacity create new stacking context.

    Also, CSS spec doesn't define this, but elements with opacity:0 are clickable, and elements with visibility:hidden are not.

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