如何使用map(备忘)

如何使用map:
area是一块区域,这块区域可以当作导航用:
< area  shape ="rect"  coords ="240,235,140,300"  href ="http://www.vertigosoftware.com"
                target
="_blank"  alt ="Vertigo Software"   />
shape属性指明了区域的形状, coords指明了形状边界的几个点, href为导航到哪里的url

area不能独立出现, 必须嵌套在map中, map只作为area的容器:
< map  id ="vertigosoftware"  name ="vertigosoftware" >
            
< area  shape ="rect"  coords ="240,235,140,300"  href ="http://www.vertigosoftware.com"
                target
="_blank"  alt ="Vertigo Software"   />
        
</ map >


map要放哪里呢?请看
< img  src ="Comm_Images/home-fish.gif"  alt ="Created by Vertigo Software, Inc."  usemap ="#vertigosoftware"
                        border
="0"   />
这里的usemap属性就是引用map. 相当去在img上又放了个透明的img层, 层中的area指明了url以及可点击区域.

完整例子:
< img  src ="Comm_Images/home-fish.gif"  alt ="Created by Vertigo Software, Inc."  usemap ="#vertigosoftware"
                        border
="0"   />

< map  id ="vertigosoftware"  name ="vertigosoftware" >
            
< area  shape ="rect"  coords ="240,235,140,300"  href ="http://www.vertigosoftware.com"
                target
="_blank"  alt ="Vertigo Software"   />
        
</ map >

你可能感兴趣的:(map)