Home>Article>Web Front-end> How to hide div on click in css3
In css3, you can use the ":active" selector and display attribute to achieve the effect of clicking to hide the div. You only need to add "" to the div element
The operating environment of this tutorial: windows7 system, CSS3&&HTML5 version, Dell G3 computer.
In CSS3, you can use the ":active" selector and display attribute to achieve the effect of clicking to hide the div.
Implementation code:
点击隐藏div元素
: active selector
active’s English interpretation is “active” , which means click on the mouse.
After setting the element todisplay:none
, the element will disappear completely on the page, and the space originally occupied by the element will be occupied by other elements, which means it will cause the browser to Reflow and redraw.
(Learning video sharing:css video tutorial)
The above is the detailed content of How to hide div on click in css3. For more information, please follow other related articles on the PHP Chinese website!