当我的按钮包含徽标图像时,为什么我的按钮会垂直拉伸?
我正在使用parwindcss。我里面有一个flexbox容器和一个登录按钮。 按钮看起来好像正在伸展。
<nav font-am class="m-6 text-xl">
<div class="flex flex-row justify-between container">
<div>
<img src="./img/Logo.png">
</div>
<div class="flex flex-row">
<a href="#"><img src="./img/AccountLog.png"></a>
<p class="hidden md:flex">My Account</p>
</div>
<div class="flex flex-row">
<a href="#"><img src="./img/love_symbol.png"></a>
<p class="hidden md:flex">My List</p>
</div>
<div class="flex box-border flex-row">
<a href="#"><img src="./img/LockLogo.png"></a>
<button class="bg-darkPink hover:underline text-white font-bold py-2 px-4 rounded-full" role="button">Sign In</button>
</div>
</div>
</nav>
这是徽标的外观:
,当我删除徽标时,按钮将正常显示:
当徽标打开时,我该怎么办才能保持按钮看起来正常。徽标是否占用太多空间?
I'm using tailwindcss. I have a flexbox container and a login button inside it.
The button looks like it's being stretched.
<nav font-am class="m-6 text-xl">
<div class="flex flex-row justify-between container">
<div>
<img src="./img/Logo.png">
</div>
<div class="flex flex-row">
<a href="#"><img src="./img/AccountLog.png"></a>
<p class="hidden md:flex">My Account</p>
</div>
<div class="flex flex-row">
<a href="#"><img src="./img/love_symbol.png"></a>
<p class="hidden md:flex">My List</p>
</div>
<div class="flex box-border flex-row">
<a href="#"><img src="./img/LockLogo.png"></a>
<button class="bg-darkPink hover:underline text-white font-bold py-2 px-4 rounded-full" role="button">Sign In</button>
</div>
</div>
</nav>
Here is how it looks with the logo:
And the button is displayed normally when I delete the logo:
What should I do to keep the button looks normal when the logo is on. Is the logo taking up too much space or something?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您将按钮设置为弹性行中的拉伸弹性元件。您可以做几件事之一来解决它:
这两个解决方案均显示在此处。
You've set your button as a stretched flex element in a flex row. You can do one of several things to fix it:
Both solutions are shown here.
您可以为DIV提供链接的父和按钮的tailwind类
grow-0
和shink> shink-0
,以防止其改变形状。设置items-center
将锁定图标与按钮对齐。You can give the div which is the parent of the link and the button the tailwind classes
grow-0
andshrink-0
to prevent it from changing shape. Setitems-center
to align the lock icon vertically with the button.不要让徽标在
display中消失:无
,使用不透明度:0
Don't let the logo disappear with
display:none
, do it withopacity:0