/* +------------------------------------------------------------------+ | Green-Beast.com | | CSS: Map Pop | | Cascading Style Sheet | | Copyright June 2006 | | Use with attribution by visible link please! | | Attribute to: Mike Cherim | +------------------------------------------------------------------+ */ /* Here's the list that houses the image as a background */ ul#cmp { list-style-type : none; position : relative; display : block; background : transparent url(images/cmp_flat.jpg) no-repeat 0 0; width : 350px; height : 250px; border : 1px solid #000; margin : 0 auto 0; /* the auto part is for optionally centering the list */ padding : 0; } /* This makes the list items (links and spans) easier to manage (float control) */ ul#cmp li { display : inline; } /* Here are link specs and relationship setup */ ul#cmp li a { position : relative; display : block; text-decoration : none; } /* This gets rid of the main content-containing outer span and all within, but it remains available to assistive technologies */ ul#cmp li a span.offset { margin-top : -9000px; margin-left : -9000px; position : absolute; } /* This is the general hover and focus state link-span properties */ ul#cmp li a:hover span.offset, ul#cmp li a:focus span.offset, ul#cmp li a:active span.offset { color : #000; background-image : none; background-color : #ffffde; border : 1px solid #000; display : block; width : 150px; height : auto; text-decoration : none; cursor : pointer; } /* This sets the inner span. Padding on the main span was tried but produced odd results in IE (go figure) */ ul#cmp li a:hover span.offset span, ul#cmp li a:focus span.offset span, ul#cmp li a:active span.offset span { display : block; width : 140px; margin : 5px; } /* No embedded image styles are needed except maybe border : 0 (not needed here). Images are optional though, as is text. Place images in main outer span. Text goes within the inner span What follows are CSS blocks, one for each list item link. This is a solid solution, but it uses a lot of CSS info. I will comment the first block only. */ /* Hot-Spot Number One (1) */ /* This sets the size of the list item link area and its location relative to the UL */ ul#cmp li a#cmp01 { width : 80px; height : 60px; margin-top : 0; margin-left : 130px; } /* On hover/focus I grab the second background image, the one with the hover/focus state changes. I also set its position underneath the sized window I created with the hover/focus link properties. */ ul#cmp li a#cmp01:hover, ul#cmp li a#cmp01:focus, ul#cmp li a#cmp01:active { background : transparent url(images/cmp_flat_on.jpg) no-repeat -130px 0px; } /* Now I have to set the position of the outer span in relation to the list item link */ ul#cmp li a#cmp01:hover span.offset, ul#cmp li a#cmp01:focus span.offset, ul#cmp li a#cmp01:active span.offset { margin-top : -1px; margin-left : 230px; } /* Hot-Spot Number Two (2) */ ul#cmp li a#cmp02 { width : 110px; height : 75px; margin-top : -50px; margin-left : 235px; } ul#cmp li a#cmp02:hover, ul#cmp li a#cmp02:focus, ul#cmp li a#cmp02:active { background : transparent url(images/cmp_flat_on.jpg) no-repeat -235px -10px; } ul#cmp li a#cmp02:hover span.offset, ul#cmp li a#cmp02:focus span.offset, ul#cmp li a#cmp02:active span.offset { margin-top : -11px; margin-left : 125px; } /* Hot-Spot Number Three (3) */ ul#cmp li a#cmp03 { width : 75px; height : 95px; margin-top : 3px; margin-left : 115px; } ul#cmp li a#cmp03:hover, ul#cmp li a#cmp03:focus, ul#cmp li a#cmp03:active { background : transparent url(images/cmp_flat_on.jpg) no-repeat -115px -88px; } ul#cmp li a#cmp03:hover span.offset, ul#cmp li a#cmp03:focus span.offset, ul#cmp li a#cmp03:active span.offset { margin-top : -89px; margin-left : 245px; } /* Hot-Spot Number Four (4) */ ul#cmp li a#cmp04 { width : 110px; height : 120px; margin-top : -60px; margin-left : 5px; } ul#cmp li a#cmp04:hover, ul#cmp li a#cmp04:focus, ul#cmp li a#cmp04:active { background : transparent url(images/cmp_flat_on.jpg) no-repeat -5px -123px; } ul#cmp li a#cmp04:hover span.offset, ul#cmp li a#cmp04:focus span.offset, ul#cmp li a#cmp04:active span.offset { margin-top : -124px; margin-left : 355px; } /* Hot-Spot Number Five (5) */ ul#cmp li a#cmp05 { width : 95px; height : 97px; margin-top : -90px; margin-left : 240px; } ul#cmp li a#cmp05:hover, ul#cmp li a#cmp05:focus, ul#cmp li a#cmp05:active { background : transparent url(images/cmp_flat_on.jpg) no-repeat -240px -153px; } ul#cmp li a#cmp05:hover span.offset, ul#cmp li a#cmp05:focus span.offset, ul#cmp li a#cmp05:active span.offset { margin-top : -154px; margin-left : 120px; } /* End Styles */