Using CSS to realize hover dynamic effect

Source: Internet
Author: User

A special effect on the text hover, can be used to adjust the element CSS properties to complete, although only to achieve some simple action, carefully combined can achieve satisfactory results.

1. Font CHANGE:

<!DOCTYPE HTML><HTMLLang= "en">    <Head>        <MetaCharSet= "UTF-8">        <title>Test</title>        <style>Em:hover{font-size:2em;  }Strong:hover{Font-weight:Normal;  }Span:hover{Color:Blue; }        </style>    </Head>    <Body>        <em>Suspension becomes larger</em><BR>        <strong>Suspension thinning</strong><BR>        <span>Color of floating variable</span>    </Body></HTML>

The results are as follows:

Suspension becomes larger
Suspension Thinning
color of floating variable

2. Zoom and Rotate:

<!DOCTYPE HTML><HTMLLang= "en">    <Head>        <MetaCharSet= "UTF-8">        <title>Title</title>        <style>            *{transition:All linear 2s;}Em:hover{Display:Inline-block;Transform:Scale (2);  }Span:hover{Display:Inline-block;Transform:Rotate (360deg);   }        </style>    </Head>    <Body>        <span>Hover here to rotate</span>        <em>Hover here to enlarge</em>    </Body></HTML>

The results are as follows:

hover here to rotate hover here to enlarge

Can look large, here the amplification does not affect the row height as above, more is a kind of projection effect.

3. Change the background and frame:

<!DOCTYPE HTML><HTMLLang= "en">    <Head>        <MetaCharSet= "UTF-8">        <title>Title</title>        <style>. Background{width:200px;Height:50px;  }. Background:hover{background:Yellowgreen; }. Border{width:200px;Height:50px;Border:2px Solid Transparent;  }. Border:hover{Border:2px solid Black;}        </style>    </Head>    <Body>    <Pclass= "Background">hover here to show background color</P>    <Pclass= "Border">hover here appears border</P>    </Body></HTML>

The results are as follows:

Hover here to show background color

Hover here appears border

To not affect the position after the border display changes, so the border is set to transparent color, if you want to achieve a dynamic effect, you can not hover without a border, so that the text will be suspended when there is a dynamic process.

Using CSS to realize hover dynamic effect

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.