Created
January 25, 2016 13:43
-
-
Save nishinoshake/081749eb62bd3bbf316a to your computer and use it in GitHub Desktop.
Visibility:hiddenの不思議
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
visibility: hiddenはレイアウトへの影響を残す。 具体的には次の3つ。 | |
・要素の表示領域を残す | |
「要素が生成するボックスのみ残り、要素自体は無くなる」と考えると分かりやすい | |
・要素の表示域が空白になる。 | |
クリックなどのマウスイベントを受け付けなくなる。 | |
・子孫要素を表示可 | |
visibility: visibleを指定することで、指定の子孫要素以下を可視化できる。 | |
他の要素への影響を残す | |
marginやfloatなども有効なままで、単に空白を残すだけではない | |
これを利用して、疑似要素と合わせたclearfixがよく使われていた | |
参考 | |
http://7cc.hatenadiary.jp/entry/visibility-display |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment