简体   繁体   English

HTML / JS / PHP使用相同文件的两个页面看起来有所不同(仅适用于chrome)

[英]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.

相关问题 如何为 HTML 个页面使用相同的 JS 文件? - How to use same JS files for HTML pages? 在两个不同的页面中使用相同的重定向 function - Using the same redirect function in two different pages 如何使用javascript将相同的变量从php发送到两个不同的php页面 - How to send the same variable from php to two different php pages using javascript 需要在同一HTML页面调用的两个不同JS文件中的两个$(document).ready函数之间确定优先级 - Need to prioritize between two $(document).ready functions in two different JS files being called by the same HTML page 是否可以在两个不同的 html 页面中刷新相同的内容? - is it possible to refresh the same content in two different html pages? 仅使用HTML / PHP / JScript将来自两个不同HTML源的变量发送到单个PHP脚本 - Sending variables from two different HTML sources to a single PHP script using HTML/PHP/JScript only 使用同一CSS文档的不同HTML页面上的链接颜色不同 - Different link color on different html pages using the same css doc jQuery-将相同的变量发送到两个不同的PHP页面 - jQuery - send same variables to two different PHP pages 在不同设备(JS)上的两个不同HTML文件之间进行通信 - Communicate between two different HTML files on different devices (JS) 使用两个js文件的相同脚本? - The same script using two js files?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM