A small example of moving the mouse in and out to change the CSS style
Source: Internet
Author: User
In a certain area on the webpage, the style is changed when the mouse moves in, and the style is automatically restored when the mouse moves out. It can be the border of an image, or the color of a text segment, it seems that webpage interaction can be richer and more vivid. Here, JavaScript is used to control the DIV where the Hover tag is located to generate actions, which is also a good example of learning. <Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8"> <br/> <style> body {color: # fff; font: 12px/1.5 Tahoma;} # div1 {width: 150px; height: 150px; margin: 0 auto; padding: 10px; background: black; border: 10px solid #000; cursor: crosshair ;}# div1.hover {color: red; background: # f0f0f0; border: 10px solid red ;}</style> <p> move the mouse to change the style and move the mouse to restore. <P>
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]
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