<分区>
编辑问题以包含 desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem .这将有助于其他人回答问题。
关闭 5 年前。
<分区>
编辑问题以包含 desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem .这将有助于其他人回答问题。
关闭 5 年前。
我有一行规则的文本,水平居中。但是我无法在这个居中文本的左侧放置一个很棒的字体图标。
我用于对齐的任何 CSS 规则,将图标放在最左边,文本居中。
我正在为 WordPress 使用 Avada 主题。
如有任何帮助,我们将不胜感激。
最佳答案
获取 p 元素中的图标和文本,然后将 p 居中。
查看此 Pen .
html
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.13/css/all.css" integrity="sha384-DNOHZ68U8hZfKXOrtjWvjxusGo9WQnrNx2sqG0tfsghAvtVlRW3tvkXWZh58N9jp" crossorigin="anonymous">
<div class="container">
<p><i class="fas fa-camera-retro"></i> Icon text</p>
</div>
CSS
.container p {
text-align: center;
}
关于css - 水平居中 Font Awesome 图标和文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50663669/