Академический Документы
Профессиональный Документы
Культура Документы
Hover over the country to reveal the national flag. This map, including mouse over national flags, is constructed with one image and positioning on hover controlled with a css file.
The HTML
<ul id="m-east"> <li id="chd"><a href="#">Chad</a></li> <li id="cyp"><a href="#">Cyprus</a></li> <li id="egy"><a href="#">Egypt</a></li> <li id="gre"><a href="#">Greece</a></li> <li id="irq"><a href="#">Iraq</a></li> <li id="isr"><a href="#">Israel and Palestinian Territories</a></li> <li id="jor"><a href="#">Jordan</a></li> <li id="leb"><a href="#">Lebanon</a></li> <li id="lib"><a href="#">Libya</a></li> <li id="sau"><a href="#">Saudi Arabia</a></li> <li id="sin"><a href="#">Sinai</a></li> <li id="sud"><a href="#">Sudan</a></li> <li id="syr"><a href="#">Syria</a></li> <li id="tur"><a href="#">Turkey</a></li> </ul>
List styling
#m-east li {display: block; position: absolute; list-style: none; margin: 0; padding: 0; }
Link styling
#m-east a { display: block; text-indent: -9999px; text-decoration: none; outline: none; cursor: default; }
An explaination of z-index
The image area being targeted is a rectangle, you can view the image with the blocks marked to see what I mean. Because a lot of the countries overlap some will need some assistance to show up, hovering around the Chad/Libya border is an example of this. With your mouse that is. Hovering around African borders is not recommended, very dodgy. If you did look at the block image you would have noticed that Israel is nearly completely over lapped by the surrounding countries. To allow a reasonable chance of Israel showing up, I've given it a z-index value (30). This basically means it is higher in the stack than the larger Jordan (z-index 20), effectively taking it's territory to the east of the Dead Sea. Mmm, so unlike Israel to do that Iraq is also assigned a z-index value (10).
#irq {left: 424px; top: 0px; z-index: 10;} #isr {left: 340px; top: 82px; z-index: 30;} #jor {left: 350px; top: 86px; z-index: 20;}
For a full and very good explaination of z-index go to the site '24ways (to impress your friends)', which has an article called Z's not dead baby, Z's not dead on the subject.
A ***png apology
Ok here goes. I've catered for IE6 since this site has been in existence (2004) and quite frankly it's been a pain, what with css hacks, non png support and not having all the funky things that other browsers have had for years; opacity, border-radius to name only two. So now as I type this (Sept 2008), 10% of the browser hits are IE6. Using png's instead of gif's are a far superior option. IE6's non support of png transparency is not worth me supporting them any more. I'm sorry if IE6 users see white backgrounds instead of transparency, but it's better than everyone else with modern browsers seeing patchy images on optimised USB stick modems. All modern browsers can handle png's and even Windows 2000 users, who can't update to IE7 or IE8, can use Firefox or Opera for Windows, which are better browsers anyway. IE6 users will only reduce in size, while mobile USB stick modem users will definitely increase. Rant over.
Credit
Not me! I found this while browsing www.tanfa.co.uk, our map is a version of the CSS Image Rollover Map ~ Europe. Although having said that, I spent a while creating the image and even longer messing around with the css file to get the positioning correct. And I've added the opacity tip to make your life easier, so big up to me Tanfa, is also a great place for css related information and tutorials. The navigation menu used on this site was developed from a tutorial there.