我試圖在一行內創建三個不同的<div>s
之間的空格。我試圖按照this answer,但由於某種原因,我得到了不好的結果:如何在同一行內分配多個div /分區
此外,我不試圖將這三個部分均勻地分開,就像他希望在那篇文章中。這正是我要爲:
所以我應該有三個獨立的部分 - 一個用於「通過門戶網站設計自適應網站」,一爲社交媒體鏈接,以及一個滾動到頂部的箭頭。這裏是我的代碼:
HTML:
</body>
<footer>
<div class="footer-row">
<div class="responsive-website-by">
<p>Responsive Website by <a href="http://www.gatewaywebdesign.co.uk/" target="blank">
Gateway Web Design</a>
</p>
</div>
<div id="social-links">
<a href="http://youtube.com" target="blank">
<i class="fa fa-youtube" style="font-size: 24px"></i>
</a>
<a href="http://instagram.com" target="blank">
<i class="fa fa-instagram" style="font-size:24px"></i>
</a>
<a href="http://twitter.com" target="blank">
<i class="fa fa-twitter" style="font-size:24px"></i>
</a>
<a href="http://facebook.com" target="blank">
<i class="fa fa-facebook" style="font-size:24px"></i>
</a>
</div>
<div id="scroll-to-top">
<button id="scroll-to-top-icon" onclick="scrollToTop(1000);">^</button>
</div>
</div>
</footer>
<?php wp_footer(); ?>
</html>
CSS:
/* FOOTER */
footer {
background-color: #000000;
height: 55px;
}
.footer-row {
display: table;
width: 100%; /*Optional*/
table-layout: fixed; /*Optional*/
border-spacing: 10px; /*Optional*/
}
#social-links {
padding-right: 40px;
display: table-cell;
}
#social-links a {
color: white;
float: right;
text-decoration: none;
margin: 20px;
margin-top: 15px;
}
#social-links a:hover {
color: #966948;
transition: all 0.2s ease-in-out;
}
.responsive-website-by {
color: #BCBEC0;
float: left;
padding-left: 40px;
padding-top: 3px;
display: table-cell;
}
.responsive-website-by a{
color: white;
text-decoration: none;
}
.responsive-website-by a:hover{
color: #966948;
text-decoration: none;
transition: all 0.2s ease-in-out;
}
#scroll-to-top {
float:right;
display: table-cell;
}
#scroll-to-top-icon {
background-color: #966948;
border: none;
font-size: 35px;
height: 30px;
width: 34px;
padding-bottom: 31px;
}
而且不能夠空間出來,我想水平的方式,我不明白爲什麼他們也被推倒在頁腳之外。我試着註釋掉利潤/墊襯對於那些選擇,但問題仍然存在:
請幫幫忙!謝謝。
編輯:
您可以在這張截圖的responsive-website-by
DIV自動按下被軀內看到,更不用說其他的div是如何被下推 - 爲什麼?
你可以創建[小提琴](http://jsfiddle.net)? –
@ iuliu.net當然有一點....也請看看上面的修改。 – HappyHands31
Js小提琴鏈接:https://jsfiddle.net/jn32sxjr/1/。它看起來像小提琴不支持字體真棒圖標,所以我用它們各自的首字母替換它們。 – HappyHands31