home / experts / javascript / column66 |
|
Changing Styles using ClassesCSS attributes can also be specified in the page's style sheet. You can modify styles dynamically by changing the element's class. Let's implement the color changing example from Page 3: Mouse over me to see my over color. Then mouse out to see my out color.Here is the html code:
This is the time to explain the concept of style assignment priority. You can define an element's style in many different ways. There is a pre-defined priority order between these methods. An element's own scripting always has the highest priority. Its own inline
Notice the style assignment hierarchy: setting color by inherited CLASS
Here is the HTML code for the example above:
Notice the style assignment hierarchy: setting color by inherited inline STYLE
Here is the HTML code for the example above:
Notice the style assignment hierarchy: setting color by inherited scripting
Here is the HTML code for the example above:
Notice the style assignment hierarchy: setting color
by own CLASS
Here is the HTML code for the example above:
Notice the style assignment hierarchy: setting color by own inline STYLE
Here is the HTML code for the example above:
Notice the style assignment hierarchy:
setting color by own scripting
Here is the HTML code for the example above:
|
Produced by Yehuda Shiran and Tomer Shiran
Created: August 14, 2000
Revised: August 14, 2000
URL: http://www.webreference.com/js/column66/***PASTE FILENAME HERE***