CSS Basic
CSS HOMECSS Introduction
CSS Syntax
CSS Id & Class
CSS How To
CSS Styling
Styling BackgroundsStyling Text
Styling Fonts
Styling Links
Styling Lists
Styling Tables
CSS Box Model
CSS Box ModelCSS Border
CSS Outline
CSS Margin
CSS Padding
CSS Advanced
CSS Grouping/NestingCSS Dimension
CSS Display
CSS Positioning
CSS Floating
CSS Align
CSS Pseudo-class
CSS Pseudo-element
CSS Navigation Bar
CSS Image Gallery
CSS Image Opacity
CSS Image Sprites
CSS Media Types
CSS Attribute Selectors
CSS Don't
CSS Summary
CSS Examples
CSS ExamplesCSS Quiz
CSS QuizCSS Certificate
CSS References
CSS ReferenceCSS Reference A to Z
CSS Reference Aural
CSS Web Safe Fonts
CSS Units
CSS Colors
CSS Colorvalues
CSS Colornames
CSS Don't
| « Previous | Next Chapter » |
Here are some technologies you should try to avoid when using CSS.
Internet Explorer Behaviors
What is it? Internet Explorer 5 introduced behaviors. Behaviors are a way to add behaviors to HTML elements with the use of CSS styles.
Why avoid it? The behavior attribute is only supported by Internet Explorer.
What to use instead? Use JavaScript and the HTML DOM instead.
Example 1 - Mouseover Highlight
The following HTML file has a <style> element that defines a behavior for the <h1> element:
| <html> <head> <style type="text/css"> h1 { behavior:url(behave.htc); } </style> </head> <body> <h1>Mouse over me!!!</h1> </body> </html> |
The XML document "behave.htc" is shown below:
Example (IE 5+ Only)The behavior file contains a JavaScript and event handlers for the elements.
Try it yourself » |
Example 2 - Typewriter Simulation
The following HTML file has a <style> element that defines a behavior for elements with an id of "typing":
| <html> <head> <style type="text/css"> #typing { behavior:url(behave_typing.htc); font-family:"courier new"; } </style> </head> <body> <span id="typing" speed="100">IE5 introduced DHTML behaviors. Behaviors are a way to add DHTML functionality to HTML elements with the ease of CSS.<br /><br />How do behaviors work?<br /> By using XML we can link behaviors to any element in a web page and manipulate that element.</p> </span> </body> </html> |
The XML document "typing.htc" is shown below:
Example (IE 5+ Only)
Try it yourself » |
| « Previous | Next Chapter » |
