The CSS attribute visibility and opacity are used to replace the jQuery events that the mouse passes by. visibilityjquery

Source: Internet
Author: User

The CSS attribute visibility and opacity are used to replace the jQuery events that the mouse passes by. visibilityjquery

I have been using jQuery's hover () function to write the mouse over the event. In the past few days, I found that other colleagues can use CSS directly. I tried it online:

Of course, there is no precondition. You need to use the position/top/left attribute together with some positioning attributes ). The Code is as follows:

<! DOCTYPE html> View Code

 
  • As to why positioning attributes should be used together, you can first understand the visibility attribute: visibility attribute _ w3cschool
  • Another attribute, opacity: opacity attribute _ w3cschool, is not clear about a part of the w3cschool. After adding CSS, the tool is tested and found. the child element p of test does not continue its opacity attribute value.

What I don't understand:

Added CSS code:

    .test {       margin-top: 20px;       opacity: 0.5;    }

The child element p does not continue its opacity attribute value:

 

Summary: of course, this is just a simple display of events with the mouse. To be more complex, you still need to use jQuery to write.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.