How does the CSS implement the auto-shadow effect when the mouse moves to the div block?

Source: Internet
Author: User
When we browse the major websites, we can click on the images to enlarge, rotate, and so on. This effect can really make a person's eyes bright, also may bring the user clicks the traffic. Of course, powerful CSS features are more than just such effects. This article will introduce a more cool effect that is when the mouse moves into the div block generated by the CSS shadow effect, so that you can immediately create three-dimensional sense.

The CSS shadow effect specific code example is as follows:

  <style>        . shadow{            float:left;            margin-left:20px;            Background: #EEFF99;            width:200px;            height:400px;        }        . shadow:hover{            -webkit-box-shadow: #ccc 0px 10px 10px;            -moz-box-shadow: #ccc 0px 10px 10px;            Box-shadow: #ccc 0px 10px 10px;  }    </style>

The above code tests the effects of CSS shaded borders such as:

Note: Whether to add shadow to that element is inseparable from an important attribute: hover pseudo-class.

: The hover pseudo-class adds a special style to this element when the mouse is moved over the element. As long as you have mastered the use of this hover, whether it is to the div block or picture and shadow can easily achieve this effect.

This pseudo-class is an element where the application is in "hover state". Hover is defined as the user indicates an element but does not activate it. The most common example of this is moving the mouse pointer within the bounds of a hyperlink in an HTML document. In theory, other elements can also be in hover state, but CSS does not define exactly which elements.

"Recommended for the relevant content"

How to use CSS in the page to make the image have three-dimensional effect? (code measured)

HTML5 Speed 3D Stereoscopic photo album switch effect

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.