css - 在不超出父 div tailwindcss 的情况下 float 右键

标签 css sass tailwind-css

我正在尝试将一个按钮 float 到卡片的右侧。我希望它出现在右下角。

当我正确使用 float 时。它出现在父 div 之外,有没有办法正确定位它?

<div class="m-10">
    <div>
        <div class="bg-white shadow-lg border-grey w-1/3 ">
            <div class="p-4 flex">
                <div class="pt-3 text-center font-bold text-2xl w-16  h-16 bg-grey-lightest">
                    D
                </div>
                <div class="ml-4">
                    Team Name
                </div>
            </div>
            <div class="float-right">
                <a :href="'/company/' + team.id">
                    <button class="ml-2 bg-blue hover:bg-blue-dark text-white text-sm font-bold rounded p-2">
                        View
                    </button>
                </a>
            </div>
        </div>
    </div>
</div>

enter image description here

我这里有一个正在运行的沙箱,里面有代码

https://codesandbox.io/s/tailwind-css-nl0ph

最佳答案

不要使用 float-right 类,而是使用 text-right

关于css - 在不超出父 div tailwindcss 的情况下 float 右键,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56233184/

相关文章:

javascript - 让div在我的侧边栏的右边

css - 在 css 中制作此列表的最佳方式

css - 我怎样才能创建这样的形状?

html - 高级 CSS 数据选择器——SASS 还是 RegEx?

css - 标题上方的顺风文本

css - 如何定位一个元素以使用屏幕的剩余空间而不溢出它 [TailwindCSS]

angular - 如何使用顺风实现最佳拟合布局,例如谷歌与网格会面

html - 如何在文件上传输入中设置按钮样式

html - Sass CSS - 更改导航栏链接颜色

javascript - 如何单击下拉列表中的链接并通过实时搜索显示在文本框中,然后在删除时删除值