[英]TailwindCSS FontAwesome svg icons not aligned
I am using fontawesome's react icons in a project, and setting up a social links bar.我在一个项目中使用 fontawesome 的 react 图标,并设置了一个社交链接栏。 For some reason the first icon in the set doesn't line up right.
由于某种原因,集合中的第一个图标没有正确排列。 I think it's due to something I'm doing wrong with tailwindcss, since if I use the same code without tailwind's classes it lines up as expected.
我认为这是由于我在使用 tailwindcss 时做错了什么,因为如果我使用相同的代码而不使用 tailwind 的类,它会按预期排列。 I can tweak the svg view port manually and give the first icon a
-100
Y value, but I don't think I can manually set these in the fontawesome react component.我可以手动调整 svg 视口并给第一个图标一个
-100
Y 值,但我认为我不能在 fontawesome react 组件中手动设置这些。
https://codesandbox.io/s/boring-leftpad-bi0d7?file=/src/App.js https://codesandbox.io/s/boring-leftpad-bi0d7?file=/src/App.js
Is there a change I can make to the CSS to make this render properly?我可以对 CSS 进行更改以正确渲染吗?
You need to remove the class space-y-1
as it has the below code:您需要删除 class
space-y-1
,因为它具有以下代码:
.space-y-1>:not([hidden])~:not([hidden]) { /* This selects all elements after the first element */
--tw-space-y-reverse: 0;
margin-top: calc(.25rem * calc(1 - var(--tw-space-y-reverse)));
margin-bottom: calc(.25rem * var(--tw-space-y-reverse));
}
Codesandbox demo: https://40m92.csb.app/ Codesandbox 演示: https://40m92.csb.app/
Output: Output:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.