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]