


Which of the several methods of hiding elements in css can trigger click events?
Among the several ways to hide elements in css, the click event can be triggered by
with opacity set to 0 method.
How to hide elements in css:
1. display:none;
.box{ display: none; }
The simplest and most crude method is to set the display attribute of the element is none.
Elements set to display:none; will no longer occupy page space, and the space they occupy will be occupied by other elements, which will cause the browser to be rearranged and reassembled.
2. visibility: hidden
.box{ visibility: hidden; }
Although this method can hide the element, the element will still occupy the page space, so it will only cause the browser to reassemble but not reflow. .
If you want the element to be hidden without causing changes to the page layout, it is recommended to use the visibility:hidden; method.
3, opacity:0; (filter: alpha(opacity=0); both must be written to consider compatibility)
Set the element transparency opacity attribute to 0, you can also hide page elements .
.box{ opacity:0; }
is presented in the same way as visibility:hidden; and will also occupy page space.
Event binding differences:
display:none; The element will disappear directly from the page, so the event bound to the element will not Will take effect.
visibility: hidden; Elements will not trigger bound events .
opacity:0; The element will trigger the bound event, for example, clicking will trigger the click function.
For more HTML/css knowledge, you can follow the PHP Chinese website HTML video tutorial and CSS video tutorial
The above is the detailed content of Which of the several methods of hiding elements in css can trigger click events?. For more information, please follow other related articles on the PHP Chinese website!

GooFonts is a side project signed by a developer-wife and a designer-husband, both of them big fans of typography. We’ve been tagging Google

Pavithra Kodmad asked people for recommendations on what they thought were some of the most timeless articles about web development that have changed their

Learning how to build GraphQL APIs can be quite challenging. But you can learn how to use GraphQL APIs in 10 minutes! And it so happens I've got the perfect

When a component lives in an environment where the data queries populating it live nearby, there is a pretty direct line between the visual component and the

Here's some legit CSS trickery from yuanchuan. There is this CSS property offset-path. Once upon a time, it was called motion-path and then it was renamed. I

Miriam Suzanne explains in a Mozilla Developer video on the subject.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Dreamweaver CS6
Visual web development tools

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

SublimeText3 Linux new version
SublimeText3 Linux latest version