[英]Html/JS/PHP two pages using the same files look different (only in chrome)
On one of my fake domains I've been working on a menu for fun. 在我的一个虚假域名中,我一直在制作一个有趣的菜单。 The menu works as expected here: 菜单在这里按预期工作:
-Removed- -已移除-
However, that page doesn't use any PHP. 但是,该页面不使用任何PHP。
-Removed- -已移除-
This page does use PHP to fill the links in the menu from a database full of fake links. 该页面确实使用PHP从充满假链接的数据库中填充菜单中的链接。 The problem is that it works as expected in IE9 but chrome for some reason adds a left:40px to the div that holds the links the first time you load the page. 问题在于,它可以在IE9中按预期方式工作,但chrome由于某些原因会在div首次加载页面时为保存链接的div添加left:40px。 Afterwords, the script looks and acts as it is supposed to. 补充说明之后,脚本将按照预期的方式运行。 I validated the html and CSS as XHTML 1.0 Strict and CSS3. 我将html和CSS验证为XHTML 1.0 Strict和CSS3。 I have not been able to test this in Firefox or opera because this computer cannot have those browsers installed. 我无法在Firefox或Opera中对此进行测试,因为此计算机无法安装这些浏览器。
The only difference HTML wise is that in the php version, the links are actually tagged as links were as the homepage version, they are simply text. HTML明智的唯一区别是,在php版本中,链接实际上被标记为链接,就像链接是首页版本一样,它们只是文本。 The CSS does contain styles for the element in the .LinkDiv class that sets margins and padding to 0px. CSS确实包含.LinkDiv类中元素的样式,该样式将边距和填充设置为0px。
If anyone is able to shine some light on this issue, that would be great. 如果有人能够在这个问题上大放光彩,那就太好了。
I added: 我补充说:
.LinkDiv {
height: 100px;
width: 175px;
display: none;
position: relative;
left: 0; /* This */
background-color: rgb(217,217,217);
}
and constantly hit refresh, sometimes in chrome it loaded correctly, others it loaded with the div 40px to the left. 并不断刷新,有时在chrome中正确加载,其他在div左侧加载了40px。
将此添加到您的css文件
.LinkDiv:nth-child(1){left:0 !important;}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.