布局在本地主机上看起来不错,但在实时网站上却中断了?

发布于 2024-12-03 10:55:28 字数 637 浏览 1 评论 0原文

这是一个奇怪的问题。我正在本地主机中构建一个新布局。布局在本地服务器中看起来完全正常;没有错误,没有浮出父框。

但是当我把它放在实时站点/实时服务器上时,布局突然中断了。侧边栏浮出父框,也有功能不起作用。

以下是一些屏幕截图:

正常布局(在本地主机上查看时):

https://i.sstatic.net/NT8t5 .png

布局损坏(在实时网站上查看时):

https://i.sstatic.net/9QlCz.png(侧边栏浮出框并移动到底部,检查下一个屏幕截图)

https://i.sstatic.net/rSDiK.png

我检查了两个源代码(在本地主机和实时站点中),奇怪的是两者完全相同。我真的不知道为什么会发生这种情况。有什么帮助吗?需要注意的是,该网站使用 Wordpress 作为 CMS。

This is some weird problem. I'm building a new layout in localhost. The layout looks perfectly normal in the local server; no errors, no floating out of parent box.

But when I put it on the live site/live server, the layout suddenly breaks. The sidebar float out of the parent box, and there are also function that does not work.

.

Here are some screenshots:

Normal layout (when viewed on localhost):

https://i.sstatic.net/NT8t5.png

Broken layout (when viewed on the live site):

https://i.sstatic.net/9QlCz.png (the sidebar floats out of the box and moved to bottom, check next screenshot)

https://i.sstatic.net/rSDiK.png

.

I've checked both source code (in localhost and live site) and oddly both are exactly similar. I really have no idea why this happens. Any help? For additional note, the site is using Wordpress for the CMS.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

醉南桥 2024-12-10 10:55:28

帖子页面和主页之间的布局不同。例如,在您的主页上,#primary#main 的子级:

<div id="main"> 
    <div id="container">
    </div><!-- #container -->

    <div id="primary" class="widget-area">
    </div><!-- #primary .widget-area -->

    <div id="secondary" class="widget-area">
    </div><!-- #secondary .widget-area -->
</div>

然而,在您的帖子页面上,#primary不是#main的子元素,从而破坏你的CSS并将侧边栏推离页面:

<div id="main"> 
    <div id="container">
    </div><!-- #container -->
</div><!-- #main -->

    <div id="primary" class="widget-area">
    </div><!-- #primary .widget-area -->


    <div id="secondary" class="widget-area">
    </div><!-- #secondary .widget-area -->

我希望这会有所帮助。

The layout isn't the same between a post's page and your home page. For example, on your home page, #primary is a child of #main:

<div id="main"> 
    <div id="container">
    </div><!-- #container -->

    <div id="primary" class="widget-area">
    </div><!-- #primary .widget-area -->

    <div id="secondary" class="widget-area">
    </div><!-- #secondary .widget-area -->
</div>

Yet, on your post pages, #primary is not a child of #main, thus breaking your CSS and pushing the sidebar off the page:

<div id="main"> 
    <div id="container">
    </div><!-- #container -->
</div><!-- #main -->

    <div id="primary" class="widget-area">
    </div><!-- #primary .widget-area -->


    <div id="secondary" class="widget-area">
    </div><!-- #secondary .widget-area -->

I hope this helps.

笑梦风尘 2024-12-10 10:55:28

请注意,在生产模式下可能会出现缓存加载等问题......
这意味着每当您尝试上传新内容时,主机可能会呈现文件的旧版本。

例如,如果您将网站上传到主机,并且有一个 css:

style.css

并且您希望更改某些内容,您可以执行以下任一操作:

1.在上传新 css 后要求托管服务重新启动服务器。

2.上传相同的文件,但使用其他名称,例如 stylev1.css

请记住在 html 标题中提及它。

这应该是问题的快速修复。

Be aware that on the production mode there can occur problems like Cache loading...
Meaning that whenever you try to upload something new, the host might render the old version of the file.

For example, if you upload your website to a host and you have a css:

style.css

And you wish to change something, you can do either:

1.Ask the hosting service to restart the server after you uploaded the new css.

or

2.Upload the same file but with another name, like stylev1.css

Remember to mention it in the header of the html.

This should be a quick-fix to the problem.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文