简体   繁体   English

在不同的页面上使用相同的ID导致图片元素无法渲染?

[英]using same ids on different pages cause of picture elements not rendering?

I'm currently building a 6 page site and have finished the template for the navigation elements, the problem is, I just put the css & js into external files for the elements that will be the same on each page but now they aren't rendering on the original page or the new page, just showing white where there should be images. 我目前正在建立一个6页的网站,并完成了导航元素的模板,问题是,我只是将css和js放入了外部文件中,每个页面上的元素都是相同的,但现在它们不再一样了在原始页面或新页面上呈现,只是在应该有图像的地方显示白色。

Is this because I used id's on the elements instead of classes? 这是因为我在元素而不是类上使用了id? I thought it wouldn't matter if the id's were on separate pages that's why I'm asking here as it could be something else. 我认为id是否在单独的页面上并不重要,这就是为什么我要在这里询问,因为它可能还有其他原因。

After putting the CSS & JS into external files Dreamweaver asked if I would like to update the links, I answered yes and it changed all background images in the external css file from (images/image.jpg) to (file:///images/image.jpg), I had to change them all back to the original path. 将CSS和JS放入外部文件后,Dreamweaver询问我是否要更新链接,我回答是,它将外部css文件中的所有背景图像从(images / image.jpg)更改为(file:/// images /image.jpg),则必须将它们全部更改回原始路径。 Problem solved. 问题解决了。

It does not matter if id's are on sepereate pages. 标识是否在单独的页面上并不重要。 You probably have a JS error somewhere in your migration. 您的迁移过程中可能会出现JS错误。 Did you load the page with firebug/chromedevelopertools/iedevelopertools open and see if there is a JS error? 您是否在打开firebug / chromedevelopertools / iedevelopertools的情况下加载页面,并查看是否存在JS错误?

ID are not the problem. ID不是问题。 check that the relative path is still correct according to the css file. 根据css文件检查相对路径是否仍然正确。 to me that seems to be the most probable mistake. 对我来说,这似乎是最可能的错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM