アイコンをモーダルの幅全体に均等に分散させるにはどうすればよいですか?ブートストラップモードでソーシャルメディアアイコンを均等に配布する方法
私はいくつかのソーシャルメディアアイコンをモーダルに入れました。モーダル・ボディの表示を与える
.fa {
padding: 12px;
font-size: 18px;
width: 30px;
text-align: center;
text-decoration: none;
display: inline-block;
margin: 5px 2px;
}
.fa:hover {
opacity: 0.7;
}
.fa-envelope {
background: #939393;
color: white;
}
.fa-twitter {
background: #55ACEE;
color: white;
}
.fa-linkedin-square {
background: #007bb5;
color: white;
}
.fa-github {
background: #2c4762;
color: white;
}
.fa-stack-exchange {
background: #125688;
color: white;
}
<div class="modal fade" id="myModal" role="dialog">
<div class="modal-dialog modal-sm">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Give me a shout via..</h4>
</div>
<div class="modal-body">
<p>
<a href="#" class="fa fa-envelope"></a>
<a href="#" class="fa fa-twitter"></a>
<a href="#" class="fa fa-linkedin-square"></a>
<a href="#" class="fa fa-stack-exchange"></a>
<a href="#" class="fa fa-github"></a>
</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-sm" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
試行用の.Fa {マージン左にこれを変更することによって解決することができる:0。 margin-right:5px; text-align:center; font-size:12px;パディング:16px;幅:自動} .fa:last-child {margin-right:0} – Super
これは、固定幅を.faに与えたためです。おそらく 'width:auto;'を試してみてください。 – Rubenxfd
ブリリアント。私はすべての木の森を見ることができませんでした。ありがとう@Rubenxfd! – Johnny