Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
mouseover and mouseoutTwo more events fired by mouse movements are mouseover and mouseout. When the mouse cursor moves into an element, a mouseover event occurs for that element. When the cursor leaves the element, a mouseout event occurs. The example in Figs. 13.6ā13.7 uses these events to achieve a rollover effect that updates text when the mouse cursor moves over it. We also introduce a technique for creating rollover imagesāthough youāve already seen that image rollover effects can be accomplished with CSS3 as well. We do not show the exampleās style.css file, because the styles it contains have all been demonstrated previously.
The HTML5 document (Fig. 13.6) contains an h1 with a nested img, a paragraph and a div with a nested unordered list. The unordered list contains the hexadecimal color codes for 16 basic HTML colors. Each list itemās id is set to the color name for the hexadecimal color value thatās displayed. The style.css file provides CSS rules that set the divās width and border and that display the unordered listās elements in inline-block format. The divās width allows only four list items per line.