CSS Dynamic Change style

Source: Internet
Author: User
Tags define
Css| News

CSS and JavaScript combined to produce special effects, further appreciate the powerful features of CSS.

  changing styles Dynamically

Let's take a look at a simpler special effect, where only the properties and mouse events are used.

We use the "Class" Class property to change the style of the document. Enlarge the text.

The code for this example is this:

<title>change style</title>
<style>
<!--
. bigchange{color:blue;font-weight:bolder;font-size:225%;
Letter-spacing:4px;background:yellow;}
* Defines the font color, weight, size, word spacing, background color of the Bigchange class *//
. Start{color:yellow;background:navy;}
* Defines the font color and background colors of the start class *//
-->
</style>
<body>
<p> please move your mouse over the blue background text below. </p>
<p> we use the "class" attribute to change the style of the document.
<span
class= "Start"
style= "Cursor:hand" >
Enlarge the text. </span> </p> </body>
* Define mouse trigger events, when the mouse is put up, the area in the format of the Bigchange class,
When the mouse leaves, the start class displays the *//

This example is very simple, easy to understand, do not say anything more.

<ptml> <pead> <title>change style</title> <style> <!--. Bigchange{color:blue;fon   t-weight:bolder;font-size:225%;  Letter-spacing:4px;background:yellow;}   * Defines the font color, weight, size, word spacing, background color of the Bigchange class *//. Start{color:yellow;background:navy; * Define the font color and background colors for the start class *//--> </style> </pead> <body> <span class= "Start" sty le= "Cursor:hand" > enlarge the text. </span> </p> </body> </ptml>

[Ctrl + A ALL SELECT hint: You can modify some of the code, and then run]



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.