gpt4 book ai didi

html - 页脚元素垂直对齐

转载 作者:太空宇宙 更新时间:2023-11-04 03:45:56 26 4
gpt4 key购买 nike

我正在尝试制作这个页脚,其中每个元素都是垂直对齐的。但出于某种原因,例如版权不是垂直对齐的。

谁能帮我找出问题所在?或者我缺少什么?

页脚 HTML:

<div id="footerSocial">
<div id="socialNetwork">
Connect with us
<a href="https://www.facebook.com/" target="_blank"><img src="/www/assets/newImages/footer/facebook.png"></a>
<a href="https://twitter.com/" target="_blank"><img src="/www/assets/newImages/footer/twitter.png"></a>
<a href="https://plus.google.com/" target="_blank"><img src="/www/assets/newImages/footer/google plus.png"></a>
<a href="http://www.pinterest.com/" target="_blank"><img src="/www/assets/newImages/footer/pinterest.png"></a>
<a href="http://tumblr.com/" target="_blank"><img src="/www/assets/newImages/footer/tumblr.png"></a>
</div>
<div id="footerNewsletter">
Subscribe to Newsletter
<input id="subscribeNewsletter" name="email" type="text">
<input id="subscribe_ok" type="image" src="/www/assets/newImages/footer/Ok.png" onclick="saveNewsletter(this);">

</div>
<div id="copyright">
Copyright 2013 - Dreaming Different
</div>
</div>

页脚 CSS:

#footerSocial { 
display: inline-block;
text-align: center;
width: 100%;
margin-top: -25px;
}

#socialNetwork {
display: inline-block;
float: left;
font-size: 10px;
color: #747474;
}

#footerNewsletter {
display: inline-block;
margin: 0 auto;
font-size: 10px;
color: #747474;
}

#footerNewsletter #subscribe_ok {
margin-bottom: -5px;
}

#copyright {
display: inline-block;
float: right;
font-size: 10px;
color: #747474;
}

#footerSocial {
border: 1px solid black;
}

#socialNetwork {
border: 1px solid green;
}

#footerNewsletter {
border: 1px solid red;
}

#copyright {
border: 1px solid blue;
}

Fiddle Demo

最佳答案

您可以使用表格布局来实现您想要的:

#footerSocial { display: table; text-align: center; width: 100%; font-size: 10px;color:     #747474;}
#footerSocial > div {display: table-cell; }
#footerNewsletter #subscribe_ok { margin-bottom: -5px; }
#footerSocial { border: 1px solid black; }
#socialNetwork { border: 1px solid green; }
#footerNewsletter { border: 1px solid red; }
#copyright { border: 1px solid blue; }

Example

关于html - 页脚元素垂直对齐,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24106519/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com