“Struggling to center align icons from font awesome.”

huangapple go评论55阅读模式
英文:

Struggling to center align icons from font awesome

问题

我尝试了许多方法来使4个图标居中显示在页面上,但在所有尝试中都失败了,请帮我。
我将放置图标的截图。

英文:

I've tried many ways to align 4 icons to he center of the page, but i failed in all of them, pls help me.
ill put a print of the icons

html


<head>
<script src="https://kit.fontawesome.com/4e49a073fe.js" crossorigin="anonymous"></script>
</head>

<body>

  <div class="icons">
       <i class="fa-brands fa-linkedin"></i>
       <i class="fa-solid fa-file" ></i>
       <i class="fa-brands fa-square-github" ></i>
       <i class="fa-solid fa-envelope" ></i>
  </div>

</body>

css

dont have cause all I tried didnt worked

print

答案1

得分: -1

你可以使用 flexbox 将页面在垂直和水平方向上居中,并为你的 div 分配 height: 100%

{
    display: flex;
    align-items: center;
    justify-content: center;
}
英文:

you can use flexbox to make it center the page both vertically and horizontally and assign height: 100% to your div

{
    display: flex;
    align-items: center;
    justify-content: center;
}

huangapple
  • 本文由 发表于 2023年3月3日 21:53:10
  • 转载请务必保留本文链接:https://go.coder-hub.com/75627948.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定