图像被设置为隐藏在网络服务器上
我有一个网站,其中包含 img
标签中的 3 个图像。当我打开本地 html 文件时,一切都很好。但是,当我上传到我的服务器时,除了图像不可见之外,页面是相同的。如果我使用 Chrome 的网络检查器,我可以看到
style="display: none; visibility: hidden; "
浏览器已添加它。如果我取消选中这些样式,图像仍然不可见。 我已经在两个完全独立的网络主机上尝试过。
Firefox 不会添加规则,但它们仍然不可见。
我的代码(在浏览器干扰之前)
<div class="grid_12" id="adswrap">
<h2>Adverts</h2>
<div class="grid_3 ads"><img src="images/ads/1.jpg" /></div>
<div class="grid_3 ads"><img src="images/ads/2.jpg" /></div>
<div class="grid_3 ads"><img src="images/ads/3.jpg" /></div>
</div>
和样式
.ads{
height: 185px;
-webkit-transition: all .2s ease-in-out;
outline: 2px solid #444;
margin: 0 35px !important;
}
.ads:hover{
-webkit-transition: all .2s ease-in-out;
position: relative;
top: -5px;
-webkit-box-shadow: 0px 5px 3px rgba(0, 0, 0, .8);
}
.ads img{
width: 220px;
}
I have a website which includes 3 images in img
tags. When i open the local html file, everything is fine. However, when i upload to my server, the page is identical, apart from the images not being visible. If i use Chrome's web inspector, i can see that
style="display: none; visibility: hidden; "
has been added by the browser. if i uncheck these stylings the image still are not visible.
I've tried it on two totally separate web hosts.
Firefox does not add the rules, but they still aren't visible.
My code (before browser interferes)
<div class="grid_12" id="adswrap">
<h2>Adverts</h2>
<div class="grid_3 ads"><img src="images/ads/1.jpg" /></div>
<div class="grid_3 ads"><img src="images/ads/2.jpg" /></div>
<div class="grid_3 ads"><img src="images/ads/3.jpg" /></div>
</div>
and the styling
.ads{
height: 185px;
-webkit-transition: all .2s ease-in-out;
outline: 2px solid #444;
margin: 0 35px !important;
}
.ads:hover{
-webkit-transition: all .2s ease-in-out;
position: relative;
top: -5px;
-webkit-box-shadow: 0px 5px 3px rgba(0, 0, 0, .8);
}
.ads img{
width: 220px;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您是否安装了广告拦截扩展程序?
也许
img
元素(或其父元素)的id
或class
中的某些内容触发了广告拦截。我可以想象扩展将允许
localhost
上的任何内容,但是一旦您将其上传到其他地方,广告拦截过滤器就会被激活。Do you have any advert blocking extension installed?
Maybe there's something about the
id
orclass
of theimg
elements (or their parents) that is triggering the advert blocking.I can imagine that an extension would allow anything on
localhost
, but once you upload it somewhere else, the advert blocking filters would be activated.检查您的图像,确保与索引页位于同一文件夹中。
尝试将
标记放在 CSS 样式之外,并尝试托管它。
您是否尝试过使用其他浏览器(例如 Opera)?
Check your image, make sure in same folder with your index page.
Try to put your
<img>
tag outside your CSS style, and try to host it.Have you try with another browser such as Opera?