CSS Mouse hover div after display div outside the button question

Source: Internet
Author: User
Yesterday writing style encountered a problem, how to let the mouse hover p, display the button outside the P, you can click to the button. The following through this article to everyone to share the CSS mouse hover p display outside the button solution, interested friends to see it together

Yesterday writing style encountered a problem, how to let the mouse hover p, display the button outside the P, you can click to the button.

The effect is as follows:

Problem:

It's a straightforward idea to set the button to Display:block at p hover, but there's a problem with the button disappearing when the mouse moves to the button and leaves the p through the distance.

Workaround:

1. Select a larger area of P

This time the button appears hover, because the mouse is still in the P (large area), so the button can be normal point to. But the problem with this method is that it expands the triggering area, and if it is intended to be triggered by the initial p, then this method does not work.

2. Add a non-visible layer

As shown in the Blue box, add an absolutely positioned area to the bottom of the button in P, so that when the mouse moves to the button, it is inside the P and the button does not disappear. The advantage of this method is that the triggering area is absolutely appropriate.


p{    Position:absolute;    . hover-help{        Position:absolute;        height:20px;        width:26px;        Left: -20px;        bottom:0;    }    }
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.