Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/82.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 我可以从图片';部分?_Html_Css - Fatal编程技术网

Html 我可以从图片';部分?

Html 我可以从图片';部分?,html,css,Html,Css,我想链接背景图像的各个部分。我必须把它放在屏幕中间。因此,图像属性 背景:“bg.png” 背景尺寸:包含 我可以从图片的部分链接吗 您将无法在背景图像中添加可单击区域,因此有两种方法可供选择 影像地图 这允许您使用 <map name="myMap"> <area shape="rect" coords="0,0,50,50" href="somewhere.html"> </map> 您可以使用绝对定位元素作为“可点击”区域,并将其定位在背景图像上

我想链接背景图像的各个部分。我必须把它放在屏幕中间。因此,图像属性

背景:“bg.png” 背景尺寸:包含

我可以从图片的部分链接吗


您将无法在背景图像中添加可单击区域,因此有两种方法可供选择

  • 影像地图 这允许您使用

    <map name="myMap">
      <area shape="rect" coords="0,0,50,50" href="somewhere.html">
    </map>
    
    您可以使用绝对定位元素作为“可点击”区域,并将其定位在背景图像上


    如果您的背景位于响应元素/布局内,您可以使用百分比来确保可单击区域也响应。

    您可以显示响应图像的示例吗?我做不到,抱歉这是一个显示响应性定位的
    #parent{
        width:200px;
        height:200px;
        background-image:url();
        position:relative;
    }
    
    #someLink{
        width:20px;
        height:20px;
        position:absolute;
        left:20px;
        top:50px;
    }