1>显示图片、用a标签实现点击图片跳转、地图标签/点击图片上固定区域跳转

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>

<body>

    <!-- 图片 -->
    <img src="dog.jpg" title="一只狗" alt"这是一只狗" usemap="#dogmap" />
    
    <!-- 用a标签实现点击图片跳转 -->
    <a href="http://www.baidu.com" target="_blank"><img src="dog.jpg" width="300" height="500" title="一只狗" alt"这是一只狗"/></a>

    <!-- 地图标签/点击图片上固定区域跳转 -->
    <map name="dogmap">
        <area shape="circle" coords="185,198,69" href="http://www.baidu.com" target="_blank" />
        <area shape="circle" coords="385,198,69" href="http://www.sina.com" target="_blank" />
        <area shape="rect" coords="50,50,100,100" href="http://www.sina.com" target="_blank" />
        <!-- 依次写各个点的坐标 -->
        <area shape="poly" coords="0,0,0,50,50,0" href="http://www.hao123.com" />

    </map>


</body>
</html>

2>index图片相对路径

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>

<body>

    <!-- ../代表往上反一层 -->
    <img src="../cat.jpg" />

    <!-- 相对路径 -->
    <img src="images/dog.jpg" />
</body>
</html>

 

版权声明:本文为tonglin0325原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/tonglin0325/p/4663297.html