嘿,我正在使用顺风css来完成我的网站。我的肚脐没有给我在手机屏幕上的全屏视图。救命啊!
您可以检查github - 网站链接上托管的原始站点。
HTML和Tailwind-CSS:
<nav class="flex justify-between bg-blue-500 w-full">
<div class="ncrt-sol mx-48 my-6">
<span class="text-white font-bold text-xl cursor-default">NCERT Solutions</span>
</div>
<div class="links">
<ul class="flex mx-40 my-6">
<li><a href="#" class="mx-8 text-white font-bold text-lg hover:text-blue-500 hover:bg-white px-6 py-2 hover:rounded-3xl duration-150">Home</a></li>
<li><a href="solution.html" class="mx-8 text-white font-bold text-lg hover:text-blue-500 hover:bg-white px-6 py-2 hover:rounded-3xl duration-150">Solutions</a></li>
<li><a href="contact.html" class="mx-8 text-white font-bold text-lg hover:text-blue-500 hover:bg-white px-6 py-2 hover:rounded-3xl duration-150">Contact</a></li>
</ul>
</div>
</nav>
我用w-full
类尝试了宽度满,但它仍然不起作用.
发布于 2022-06-19 04:40:38
尝试使用w-screen
类,该类将编译为100%vw
编辑
对于移动设备来说,ncrt-sol
和flex
类的边缘太高了。
所以这引起了麻烦。因此,与mx-40
不同,将其更改为mx-4
最后的代码是:
<nav class="flex justify-between bg-blue-500 w-full">
<div class="ncrt-sol mx-4 my-6">
<span class="text-white font-bold text-xl cursor-default">NCERT Solutions</span>
</div>
<div class="links">
<ul class="flex mx-4 my-6">
<li><a href="#" class="mx-8 text-white font-bold text-lg hover:text-blue-500 hover:bg-white px-6 py-2 hover:rounded-3xl duration-150">Home</a></li>
<li><a href="solution.html" class="mx-8 text-white font-bold text-lg hover:text-blue-500 hover:bg-white px-6 py-2 hover:rounded-3xl duration-150">Solutions</a></li>
<li><a href="contact.html" class="mx-8 text-white font-bold text-lg hover:text-blue-500 hover:bg-white px-6 py-2 hover:rounded-3xl duration-150">Contact</a></li>
</ul>
</div>
</nav>
并同样更改边距,并将断点用于更大的屏幕,如md:
、lg:
等。
希望能帮上忙!
发布于 2022-06-19 05:05:06
.ncrt-sol
div
和.links
div
的左右边距太大,不利于移动屏幕,从而导致body
元素溢出。尝试对移动设备使用较小的值。
https://stackoverflow.com/questions/72674237
复制相似问题