html - Padding Not Working 字体真棒徽标
问题描述
所以我对 HTML 和 CSS 有点陌生,所以我的问题可能有一个非常明显的答案。我的问题是我的社交媒体图标的正确填充不起作用。它们在 div 内并浮动到左侧(Bootstrap 默认设置)。
.fa {
font-size: 30px;
width: 50px;
text-align: center;
text-decoration: none;
padding: 20px;
border-radius: 100%
}
.fa:hover {
opacity: 0.7;
}
.content2 {
text-align: center;
}
/* Facebook */
.fa-facebook {
background: #3B5998;
color: white;
}
/* Twitter */
.fa-twitter {
background: #55ACEE;
color: white;
}
/*Google*/
.fa-google {
background: #dd4b39;
color: white;
}
/*Instagram*/
.fa-instagram {
background: #125688;
color: white;
}
<h2>Or Alternatively, You can Contact Us Via Our Social Media Shown Below.</h2>
<div class="col-md-4 col-md-offset-4">
<a href="#" class="fa fa-facebook"></a>
<a href="#" class="fa fa-twitter"></a>
<a href="#" class="fa fa-instagram"></a>
<a href="#" class="fa fa-google"></a>
</div>
</div>
</div>
附加信息:
使用 Bootstrap 3.3.7 和 Font Awesome 4.7.0 CSS
解决方案
您无需为填充而烦恼-您的.fa
课程可以通过以下方式更好地实现line-height
.fa {
width: 50px;
height: 50px;
line-height: 50px;
text-align: center;
font-size: 30px;
border-radius: 100%;
text-decoration: none;
}
推荐阅读
- python - 添加一列,根据它与其他两列的匹配方式进行计算
- reactjs - 尝试在同一个反应组件中加载多个 C3 图表
- git - cmake 在构建外部项目时不断忽略 GIT_TAG
- visual-studio - 通过直接从 Visual Studio 启动在 WSL 上调试 .NET Core
- perl - 在 perl 中,如何计算位向量中位设置高于 2_147_483_639 的位?
- omnet++ - CastaliaResults 绘制图表
- ruby-on-rails-4 - Rails和设计如何在重置密码时跳过验证
- sql - 将数据从 .csv 复制到 Vertica 表中
- react-native - 如何维护我的组件(
) 和 Flatlist 组件可滚动?反应原生 - python - Python搜索网页元素并将其打印到不和谐