我的网站中有一个页脚,我使用一些Fontastic字体作为社交图标。字体使用a
标签显示。在我的生活中,我不能弄清楚如何将这些标签置于div中。如果它有帮助,我使用的是带有Sass的Foundation 5框架。这是代码:
HTML
<footer>
<div id="social"class="row">
<div class="large-3 small-3 small-centered columns">
<a href="#" class="icon-gplus"></a>
<a href="#" class="icon-circled"></a>
<a href="#" class="icon-twitter"></a>
<a href="#" class="icon-linkedin"></a>
</div>
</div>
CSS
#social {
background: $grey-color;
p {
text-align: center;
margin-bottom: 24px;
}
}
.small-centered {
margin-top: 36px;
}
.icon-gplus {
display: inline-block;
font-size: 40px;
width: 55px;
height: 55px;
color: $dark-grey-color;
text-align: center;
&:hover{
color: $black;
}
}
.icon-circled {
display: inline-block;
font-size: 40px;
width: 55px;
height: 55px;
color: $dark-grey-color;
text-align: center;
&:hover{
color: $black;
}
}
.icon-twitter {
display: inline-block;
font-size: 40px;
width: 55px;
height: 55px;
color: $dark-grey-color;
text-align: center;
&:hover{
color: $black;
}
}
.icon-linkedin {
display: inline-block;
font-size: 40px;
width: 55px;
height: 55px;
color: $dark-grey-color;
text-align: center;
&:hover{
color: $black;
}
}
答案 0 :(得分:1)
您应该可以在容器上使用text-align:center
来集中图标。现在,您将text-align: center
应用于#social p
,但不存在。
.small-centered {
text-align: center;
}
答案 1 :(得分:0)
以下是有效的方法:
CSS(Sass)
#social {
background: $grey-color;
p {
text-align: center;
margin-bottom: 24px;
}
}
.small-centered {
margin-top: 36px;
text-align: center;
}
.icon-gplus {
display: inline-block;
font-size: 40px;
width: 55px;
height: 55px;
color: $dark-grey-color;
text-align: center;
@include color-transition(.35s);
&:hover{
color: $black;
}
}
.icon-circled {
display: inline-block;
font-size: 40px;
width: 55px;
height: 55px;
color: $dark-grey-color;
text-align: center;
@include color-transition(.35s);
&:hover{
color: $black;
}
}
.icon-twitter {
display: inline-block;
font-size: 40px;
width: 55px;
height: 55px;
color: $dark-grey-color;
text-align: center;
@include color-transition(.35s);
&:hover{
color: $black;
}
}
.icon-linkedin {
display: inline-block;
font-size: 40px;
width: 55px;
height: 55px;
color: $dark-grey-color;
text-align: center;
@include color-transition(.35s);
&:hover{
color: $black;
}
}
HTML
<footer>
<div id="social"class="row">
<div class="large-3 small-3 small-centered columns">
<a href="#" class="icon-gplus"></a>
<a href="#" class="icon-circled"></a>
<a href="#" class="icon-twitter"></a>
<a href="#" class="icon-linkedin"></a>
</div>
</div>
<div id="social" class="row">
<div class="large-12 columns">
<p>©Blah | Graphic Design | Web Designer | </p>
</div>
</div>
</footer>