今天我们谈一下HTML标签中的<map>标签的用法和使用场景

首先我们看下这个标签到底是干什么的!

W3C的定义:

然后兼容性:

然后与之配套使用的另一个标签:

<area/>规定其区域;

我们来看看<map>标签支不支持全局属性;=====》

发现它是支持全局属性的;

使用方法:其实<map>只是给浏览器做了一个说明,我要对一个图片创建一个区域映射;所以我们还得有一张图片指向<map>标签。作为指向那么是唯一的;所以我们可以设置id与图片对应;还可以设置name与其进行对应;

如下code;

<!DOCTYPE html>
<html>

    <head>
        <meta charset="UTF-8">
        <title>Map标签的用法</title>
        <style type="text/css">
            div{
                width: 800px;
                height: 800px;
                position: relative;
                margin: 0 auto;
            }
        </style>
    </head>

    <body>
        <div class="CsOuterdiv">
            <h2>Map标签的用法</h2>
            <img src="../../img/Sky.jpg" style="width: 600px;height: auto;" />
            <map></map>
        </div>
    </body>

</html>
View Code

//首先注意:<area/>是个单标签;

它的属性有;

<!DOCTYPE html>
<html>

    <head>
        <meta charset="UTF-8">
        <title>Map标签的用法</title>
        <style type="text/css">
            div {
                width: 800px;
                height: 800px;
                position: relative;
                margin: 0 auto;
            }
        </style>
    </head>

    <body>
        <div class="CsOuterdiv">
            <h2>Map标签的用法</h2>
            <img src="../../img/Sky.jpg" style="width: 600px;height: auto;" usemap="#MyfirstMap" border="0" alt="testimg" />
            <map id="MyfirestMap" name="MyfirstMap">
                <area shape="circle" coords="180,139,14" href ="http://www.baidu.com" alt="百度" />
                 <area shape="circle" coords="129,161,10" href ="http://jingdong.com" alt="京东" />
                  <area shape="rect" coords="0,0,110,260" href ="http://taobao.com" alt="淘宝" />
            </map>
        </div>
    </body>

</html>
View Code

 

转载于:https://www.cnblogs.com/alideai/p/7868112.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值