英文:
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
答案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;
}
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论