简体   繁体   English

从 Next.js 中的另一个页面导航后,Tailwind 样式不起作用

[英]Tailwind styling not working after navigating from another page in Next.js

I am building a site using Next.JS and tailwind.我正在使用 Next.JS 和 tailwind 构建网站。

On the homepage, the content in the wrapping divs in the project section displays in the centre.在主页上,项目部分的包装 div 中的内容显示在中心。

However, when I navigate to my about page using the navbar link, and then return to the homepage, the content in the divs no longer displays in the centre (it displays to the left).但是,当我使用导航栏链接导航到我的关于页面,然后返回主页时,div 中的内容不再显示在中心(它显示在左侧)。 This issue is not solved unless I refresh the page.除非我刷新页面,否则这个问题没有解决。

Any ideas how I can solve this issue please?请问有什么办法可以解决这个问题吗?

Thanks very much非常感谢

When changing routes to your about page and back, the class of the child element under projects changes from col-span-3 content-center place-items-center md:mx-40 to ProjectSection_proj1Left__CTWEv .当更改路由到您的关于页面并返回时,项目下子元素的 class 从col-span-3 content-center place-items-center md:mx-40更改为ProjectSection_proj1Left__CTWEv I guess that is why it breaks.我想这就是它破裂的原因。 So check if you set this somewhere (maybe even by accident).因此,请检查您是否将其设置在某处(甚至可能是偶然的)。

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

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