首页 > 解决方案 > Mozilla Firefox 未从本地计算机加载图像

问题描述

我正在尝试使用图像和 div 运行一个简单的 html 页面。

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link href="https://fonts.googleapis.com/css?family=Quicksand" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet">
<style>
	* {
  box-sizing: border-box;
}
	.container {
       width: 240px;
       height: 280px;
       position: relative;
    }
	
	 .tag {
    position: absolute;
    left: 10%;
    bottom: 0px;
	height: 220px;
	width: 202px;
    background-color: #4a8ab0;
	border-radius: 6px;
    color: #FFFFFF;
    padding: 10px;
	opacity: 0.9;
    }
	
	.sideHeader {
		font-family: 'Quicksand', sans-serif;
		font-size: 18px;
	}
	
	p {
		font-family: 'Open Sans', sans-serif;
		font-size: 11.5px;
		letter-spacing: 0.01em;
	}
	
</style>
</head>
<body>
<!--​-->
<div class="container">
       <img src="D:/ata/images/cropped_box.jpg" style="height:210px;width:240px;">
	   <div class="tag"><div class="sideHeader"><b>Did you know</b></div>
		<p>
			With HTML you can create your own Website.This tutorial teaches you everything about HTML.HTML is easy to learn - You will enjoy it.
		</p>
		</div>
</div>
</body>
</html>

我可以在显示图像和 div 的 Google chrome 和 Internet Explorer 中成功运行代码。在 Mozilla firefox 中,不显示图像。它也没有显示错误。我尝试在互联网上使用图像。这显示得很好。为什么 Mozilla 对本地数据的行为不同?这是浏览器特定的问题吗?我使用的是 66.0.2(64 位)版本的 Firefox。我该如何解决?我尝试将反斜杠更改为前斜杠。但它不起作用。请帮忙。提前致谢。

标签: htmlcssfirefoxmozilla

解决方案


那么解决方案很简单。将图像标签重写为:

<img src="file://D:/ata/images/cropped_box.jpg" style="height:210px;width:240px;">

推荐阅读