如何在HTML页面的Facebook图标上方添加fab-fa-images图标
解决方案
修改要点
- 新增独立的
.fb-group容器包裹Facebook图标和新增的images图标,设置垂直方向flex布局,实现两个图标上下垂直对齐 - 外层
.wrapper新增横向flex布局配置,保持Facebook组、YouTube、GitHub三个模块的水平排列逻辑,所有图标底部对齐 - 新增images图标的样式规则,保持和现有社交图标一致的尺寸、交互效果
- 修复原代码中重复的
<head>、<body>标签语法错误
完整修改后代码
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <title>by Nguyên Phùng</title> <meta name="viewport" content="width=device-width, initial-scale=1" /> <script src="https://kit.fontawesome.com/2daeff28dd.js" crossorigin="anonymous"></script> <style> body { background-image: url("vn.gif"); background-position: center; } button{ border: none; border-radius: 15px; box-shadow: 0 0 8px rgb(207, 207, 207); } .wrapper { position: fixed; bottom: -8px; left: 4px; padding: auto; width: 100%; /* 新增横向flex布局,底部对齐 */ display: flex; align-items: flex-end; } /* 新增fb组容器样式,垂直排列 */ .fb-group { display: flex; flex-direction: column; align-items: center; } .img-icon { display: inline-block; width: 50px; height: 40px; margin: 0 0 8px 0; line-height: 40px; font-size: 45px; text-align: center; color: black; border-radius: 4px; overflow: hidden; cursor: pointer; background-color: transparent; } .youtube { display: flex; width: 60px; height: 40px; margin: 0px; line-height: 40px; font-size: 45px; text-align: center; color: black; border-radius: 4px; overflow: hidden; cursor: pointer; background-color: transparent; } .fb { display: inline-block; width: 50px; height: 40px; margin: 0px; line-height: 40px; font-size: 45px; text-align: center; color: black; border-radius: 4px; overflow: hidden; cursor: pointer; background-color: transparent; } .github { display: inline-block; width: 50px; height: 40px; margin: 0px; line-height: 40px; font-size: 45px; text-align: center; color: black; border-radius: 4px; overflow: hidden; cursor: pointer; background-color:transparent; } .img-icon:hover { transition: 0.2s; color: #6e6e6e; transform: scale(1.1); } .fb:hover { transition: 0.2s; color: rgb(0, 122, 221); transform: scale(1.1); } .github:hover { transition: 0.2s; color:tomato; transform: scale(1.1); } .youtube:hover { transition: 0.2s; color:red; transform: scale(1.1) } </style> </head> <body> <div class="wrapper"> <!-- 新增fb组容器,包裹images图标和原fb图标 --> <div class="fb-group"> <a href="URL" class="img-icon" target="_blank"><i class="fas fa-images"></i></a> <a href="URL" class="fb" target="_blank"><i class="fab fa-facebook-f"></i></a> </div> <a href="URL" class="youtube" target="_blank"><i class="fab fa-youtube"></i></a> <a href="URL" class="github" target="_blank"><i class="fab fa-github"></i></a> </div> </body> </html>
内容的提问来源于stack exchange,提问作者AJ DS
相关产品推荐
相关产品推荐

