Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/85.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 internet explorer屏幕中的可链接部分失败_Html_Css_Internet Explorer - Fatal编程技术网

Html internet explorer屏幕中的可链接部分失败

Html internet explorer屏幕中的可链接部分失败,html,css,internet-explorer,Html,Css,Internet Explorer,我必须在两个轴上集中一个图像,然后在该图像的左上角区域添加一个可链接区域。这对webkit和ff非常有效,但ie失败了。我的html代码如下: <body> <div class="content"> <img src="images/main_image.jpg" /> <a href="#somelinkhere">Logo</a> </div> </body> 这对ie不起作用,因为我使用

我必须在两个轴上集中一个图像,然后在该图像的左上角区域添加一个可链接区域。这对webkit和ff非常有效,但ie失败了。我的html代码如下:

<body>
<div class="content">
    <img src="images/main_image.jpg" />
    <a href="#somelinkhere">Logo</a>
</div>
</body>

这对ie不起作用,因为我使用了一个显示为相应位置的内联块的a标记。我们的朋友ie根本没有在屏幕上显示可链接部分,因为文本缩进。有人能帮点忙吗?谢谢我认为这会给你带来更多帮助。

它看起来像是在创建一个容器,将其移动到屏幕底部,然后将其外部的图像移动到屏幕的左上角。这最后一步在很多情况下都会失败。在离开父容器时,子元素通常会被隐藏或切掉。IE限制性更强,但在这种情况下是正确的

将图像放置在容器外部时,可以更轻松地实现目标。请记住,身体本身就是一个容器,它始终是100%宽和高的(不能更改为50%或任何形式)

这是我们的调查结果

Html:

<body>
this is the body
<img class="my_image" src="images/main_image.jpg" />
<div class="content">   
    This is the container
    <a href="#" >Logo</a>
</div>
</body>
一般来说,最好避免负值。它们在许多浏览器中被误解并产生问题。

请查看(或仅查看结果)

HTML没有改变。我假设图像与contentdiv具有相同的高度/宽度

CSS:


你的目标是什么?为什么不在链接中放置一个图像呢?或者只是图像的一部分应该链接?此外,您还可以创建以查看其运行情况。客户端请求在两个轴上集中一个图像,然后在其左上角区域添加一个可链接区域。这就是为什么它有点复杂。它应该在什么的中心?仅内容div还是在屏幕上?图像应在屏幕内居中,可链接区域必须位于图像的左上角,如下所示。IE的可链接区域有问题。Hm。对于你的代码,我甚至在chrome上也有问题。让我检查一下,你能检查一下吗?很好,但当我放置一个真实的图像url时,链接仅适用于ie speakin always可链接区域的绿色边框。看这里,嗯。。。我不确定我是否正确理解你。据我从您的任务中了解,只有当用户单击链接区域(图片上的绿色区域或我的JSFIDLE上的绿色边框)时,才应该将其移动到另一个页面,但这仍然没有发生。这种情况只发生在边境,而不是内部。我已经把z指数设为10,但没什么变化。奇怪。让我检查一下。为
下一个代码添加css:
过滤器:alpha(不透明度=0);背景:白色;不透明度:0这对我来说很好。
<body>
this is the body
<img class="my_image" src="images/main_image.jpg" />
<div class="content">   
    This is the container
    <a href="#" >Logo</a>
</div>
</body>
body, html {
    margin: 0;
    padding: 0;
    height: 100%;
    width: 100%;
    background-color: #000;
    overflow: hidden;
}
div.content {
    position: relative;
    padding: 0;
    border:solid 1px blue;
    width: 1001px; 
    height: 626px;
    /*below will center div on screen */
    top: 50%;    
    margin: -313px auto 0;

}
div.content img {
    margin: 0;
    padding: 0;
    display: block;    
    border:solid 1px white;
   /*top:-50% removed. Assuming that image has the same height/width as content div*/
}
div.content a {        
    width: 14%;
    height: 9%;    
    position: absolute;
    /* top: -something changed. Remember that absolutely positioned div is always positioned from closest parent relative div*/
    top: 10%;
    left: 7%;
    text-decoration: none;
    margin: 0;
    padding: 0;
    text-indent: -9999px;
    border:solid 1px green;
}