在文本中间位置图标
I am having an issue with positioning in CSS. Now I have an icon and text like this :
But I want to make the icon go to the middle of the text. How do I do that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用 flex 。
实时代码: codepen html
html:
css:
只需添加图像,然后将图像替换为<代码> .Alert-icon
.Alert-close-icon
You can use Flex.
Live code: Codepen
HTML:
CSS:
Just add the images and replace them with the text inside
.alert-icon
.alert-close-icon
只需使用
显示:flex
和align-items:center
在两个元素块的父容器上对齐。Just use
display: flex
andalign-items: center
on the parent container of two block of elements to aligns.