简体   繁体   English

网站在多个负载下显示不同的布局

[英]Different layout display on website over multiple loads

I am having an extremely odd issue creating a template for my zencart ecommerce website. 我在为zencart电子商务网站创建模板时遇到了一个非常奇怪的问题。

I find that many times I load the website my menu will break up and split over two lines as shown below. 我发现很多次我加载网站后,菜单都会分解并分成两行,如下所示。

在此处输入图片说明

The reason I find this behavior odd is that if I refresh the page it correctly displays. 我发现此行为很奇怪的原因是,如果刷新页面,它将正确显示。

在此处输入图片说明

Now I could understand how to fix this if it was consistently one way or the other but it seems to vary between the two with no obvious difference in the code... I am not sure if this is some sort of technical bug with chrome as I haven't been able to replicate it in other browsers however even if it is I really need a way of working around it. 现在,我可以理解如果它始终是一种方法还是另一种方法,但是在两者之间似乎有所不同,并且代码没有明显区别,该如何解决...我不确定这是否是chrome的某种技术错误我一直无法在其他浏览器中复制它,即使我确实需要解决它的方法。 So I am curious as to whether anyone has had this issue before and if so how they got around it. 因此,我对于是否有人曾经遇到过此问题以及是否可以解决这个问题感到好奇。

Link to live site: http://digitalmatrixonline.com.au/ 链接到实时网站: http//digitalmatrixonline.com.au/

Thanks Jason 谢谢杰森

If you add 如果添加

white-space:nowrap;

To the div that contains the list it should prevent this, not sure why it's happening though. 对于包含该列表的div,应该防止这种情况发生,但不确定为什么会发生这种情况。

Edit : here is a jsfiddle showing the technique http://jsfiddle.net/RM4S2/ 编辑 :这是一个展示技术的jsfiddle http://jsfiddle.net/RM4S2/

Edit : No floats http://jsfiddle.net/BsGfu/2/ 编辑 :没有浮动http://jsfiddle.net/BsGfu/2/

This is a really strange problem, and I was able to recreate the quirkiness in Chrome. 这是一个非常奇怪的问题,我能够在Chrome中重新创建古怪的东西。 While I don't know the direct cause of the issue, I think I found one way that works. 虽然我不知道问题的直接原因,但我认为我找到了一种可行的方法。

If you set the width of the second div within 'navEZpagesTop' that you are floating right that is wrapping,to 'width:485px;'. 如果将要浮动的'navEZpagesTop'中的第二个div的宽度设置为'width:485px;'。 This seems to give the section room and does not wrap. 这似乎给部分空间,并且不包装。 If you want to leave more room for this expand without modifying the css you could set it to a much larger size, and float all the links inside of this to the right(instead of the left). 如果您想在不修改css的情况下为扩展留出更多空间,则可以将其设置为更大的大小,并将其中的所有链接浮动到右侧(而不是左侧)。

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

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