填充不相等?

发布于 2025-01-19 12:41:06 字数 1005 浏览 2 评论 0原文

当悬停在尾windcss的情况下时,我正在尝试在字体上的Awesome Icon上制作A Perfect 圆圈,但是圆的高度太长了,因此看起来像垂直的椭圆形。我认为顶部和底部的填充不等于左右填充。

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <link
      rel="stylesheet"
      href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css"
      integrity="sha512-KfkfwYDsLkIlwQp6LFnl8zNdLGxu9YAA1QvwINks4PhcElQSvqcyVLLD9aMhXd13uQjoXtEKNosOWaZqXgel0g=="
      crossorigin="anonymous"
      referrerpolicy="no-referrer"
    />
    <script src="https://cdn.tailwindcss.com"></script>
  </head>
  <body>
    <i class="hover:bg-gray-300 hover:rounded-full p-2 fa-solid fa-close"></i>
  </body>
</html>

请尝试使用parwindcss,没有样式标签。

I'm trying to make a perfect circle on the font awesome icon when hovered with tailwindcss but the circle's height is too long so it looks like a vertical oval. I think the top and bottom padding is not equal as the left and right padding.

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <link
      rel="stylesheet"
      href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css"
      integrity="sha512-KfkfwYDsLkIlwQp6LFnl8zNdLGxu9YAA1QvwINks4PhcElQSvqcyVLLD9aMhXd13uQjoXtEKNosOWaZqXgel0g=="
      crossorigin="anonymous"
      referrerpolicy="no-referrer"
    />
    <script src="https://cdn.tailwindcss.com"></script>
  </head>
  <body>
    <i class="hover:bg-gray-300 hover:rounded-full p-2 fa-solid fa-close"></i>
  </body>
</html>

please try to use tailwindcss, no style tags.

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

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

发布评论

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

评论(3

絕版丫頭 2025-01-26 12:41:06

只需手动设置图标的width高度

<i class="w-8 h-8 hover:bg-gray-300 hover:rounded-full p-2 fa-solid fa-close"></i>

Just set manually the width and height of the icon:

<i class="w-8 h-8 hover:bg-gray-300 hover:rounded-full p-2 fa-solid fa-close"></i>
强者自强 2025-01-26 12:41:06

标签是一个内联元素。您可以向内联元素的左侧和右侧添加空间,但不能向内联元素的顶部或底部内边距或边距添加高度。最好在标签上添加包装器并在包装器上使用填充。

<i> tag is an inline element. You can add space to the left and right on an inline element, but you cannot add height to the top or bottom padding or margin of an inline element. It's better to add a wrapper on tag and use padding on wrapper.

静谧 2025-01-26 12:41:06

您可以添加一个div-wrapper并相应地更改对齐方式。请参阅以下实施。

您可以使用任何图标更改 ico

<script src="https://cdn.tailwindcss.com"></script>
<div class="w-20 h-20 p-7 m-5 hover:bg-gray-300 hover:rounded-full fa-solid fa-close bg-lime-300 rounded-full">
<i >ico</i>
</div>

You can add a div-wrapper and change the alignment accordingly. Please see the below implementation.

You can change the ico with any icon.

<script src="https://cdn.tailwindcss.com"></script>
<div class="w-20 h-20 p-7 m-5 hover:bg-gray-300 hover:rounded-full fa-solid fa-close bg-lime-300 rounded-full">
<i >ico</i>
</div>

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