ReactJs overlay Font awesome 图标
ReactJs overlay Font awesone Icons
我想问一下我们如何在 ReactJS 中堆叠 Font Awesome 图标。
在HTML中我们使用下面的代码:
<span class="fa-stack fa-2x">
<i class="fas fa-circle fa-stack-2x"></i>
<i class="fas fa-flag fa-stack-1x fa-inverse"></i>
</span>
在 ReactJS 中我们使用:
<FontAwesomeIcon icon={faFlag} />
如何在用户身上叠加一个圆圈,使其看起来好像旗帜图标在圆圈中
你可以做类似的事情并与 positioning
和 flex
一起玩:
.the-wrapper {
position: relative;
}
.the-wrapper .icon {
position: absolute;
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
}
</style>
<span class="fa-stack fa-2x the-wrapper">
<FontAwesomeIcon icon={faCircle} />
<div class="icon">
<FontAwesomeIcon icon={faFlag} />
</div>
</span>
您可以将“分层”与所提供的 CSS 一起使用来实现同样的效果:
<span className="fa-layers fa-fw fa-2x">
<FontAwesomeIcon icon={faCircle} />
<FontAwesomeIcon icon={faFlag} inverse transform="shrink-5" />
</span>
我想问一下我们如何在 ReactJS 中堆叠 Font Awesome 图标。
在HTML中我们使用下面的代码:
<span class="fa-stack fa-2x">
<i class="fas fa-circle fa-stack-2x"></i>
<i class="fas fa-flag fa-stack-1x fa-inverse"></i>
</span>
在 ReactJS 中我们使用:
<FontAwesomeIcon icon={faFlag} />
如何在用户身上叠加一个圆圈,使其看起来好像旗帜图标在圆圈中
你可以做类似的事情并与 positioning
和 flex
一起玩:
.the-wrapper {
position: relative;
}
.the-wrapper .icon {
position: absolute;
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
}
</style>
<span class="fa-stack fa-2x the-wrapper">
<FontAwesomeIcon icon={faCircle} />
<div class="icon">
<FontAwesomeIcon icon={faFlag} />
</div>
</span>
您可以将“分层”与所提供的 CSS 一起使用来实现同样的效果:
<span className="fa-layers fa-fw fa-2x">
<FontAwesomeIcon icon={faCircle} />
<FontAwesomeIcon icon={faFlag} inverse transform="shrink-5" />
</span>