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

前端 未结 9 1430
予麋鹿
予麋鹿 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:24

    While making a userstyle that affects elements in a contenteditable, I noticed that if you set something to visibility: hidden, then the input caret doesn't really want to interact with it. Eg if you have

    ...then it seems if you focus that div/span, you can't actually type in it. Whereas with opacity: 0 it seems you can. I haven't tested this extensively, but figured it was worth mentioning this here as nobody else on this page has talked about the effects on text input. This seems possibly related to the events stuff mentioned above though.

提交回复
热议问题