dongyan0629 2013-10-29 10:15
浏览 31
已采纳

使用相同文件的Html / JS / PHP两个页面看起来不同(仅限于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.

-Removed-

This page does use PHP to fill the links in the menu from a database full of fake links. 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. Afterwords, the script looks and acts as it is supposed to. I validated the html and CSS as XHTML 1.0 Strict and CSS3. I have not been able to test this in Firefox or opera because this computer cannot have those browsers installed.

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. The CSS does contain styles for the element in the .LinkDiv class that sets margins and padding to 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.

  • 写回答

1条回答 默认 最新

  • dtk31564 2013-10-29 10:23
    关注

    add this to you css file

    .LinkDiv:nth-child(1){left:0 !important;}
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示
  • ¥15 求三国群英传pl国战时间的修改方法
  • ¥15 matlab代码代写,需写出详细代码,代价私
  • ¥15 ROS系统搭建请教(跨境电商用途)
  • ¥15 AIC3204的示例代码有吗,想用AIC3204测量血氧,找不到相关的代码。
  • ¥20 CST怎么把天线放在座椅环境中并仿真
  • ¥15 任务A:大数据平台搭建(容器环境)怎么做呢?
  • ¥15 YOLOv8obb获取边框坐标时报错AttributeError: 'NoneType' object has no attribute 'xywhr'