css - 对齐 Div,表格样式,用于社交媒体图标

标签 css html icons spacing

我想在我的页脚上放置一些社交媒体图标,四个图标各有两列,空间很好,但我的代码目前只能让我将所有图标放在一个彼此之上,有什么解决方案?

CSS:

.container
{
}
.container DIV
{
    width: 15px;
    margin: 1px;
}

HTML:

<div>
<div style="width: 200px;" class="container" display: "inline-block" >
<div style="float: left;"><a title="Facebook" href="http://www.facebook.com/KenyaLuxuryVillas" target="_blank"><img src= "http://villasdiani.com/wp-content/uploads/2013/02/facebook-logo-square.png" /></a></div>
<div style="float: right;"><a title="Stumbleupon" href= "http://www.stumbleupon.com/stumbler/bestbeacheskenya" target="_blank"><img src= "http://villasdiani.com/wp-content/uploads/2013/02/stumbleupon-logo-square.png" /></a></div>
<div style="float: left;"><a title="Linkedin" href= "http://ke.linkedin.com/in/luxuryvillaskenya" target="_blank"><img src= "http://villasdiani.com/wp-content/uploads/2013/02/linkedin-logo-square2.png" /></a></div>
<div style="float: right;"><a title="Twitter" href= "https://twitter.com/villasdiani" target="_blank"><img src= "http://villasdiani.com/wp-content/uploads/2013/02/twitter-bird2-square.png" /></a></div>
<div style="float: left;"><a title="Google+" href= "https://plus.google.com/u/0/108558298587711226912/" target="_blank"><img src= "http://villasdiani.com/wp-content/uploads/2013/02/google-logo-square.png" /></a></div>
<div style="float: right;"><a title="Vimeo" href= "https://vimeo.com/africashot" target="_blank"><img src= "http://villasdiani.com/wp-content/uploads/2013/02/vimeo-s.png" /></a></div>
<div style="float: left;"><a title="Skype" href= "callto://villasdiani" target="_blank"><img src= "http://villasdiani.com/wp-content/uploads/2013/02/skype-s.png" /></a></div>
<div style="float: right;"><a title="YouTube" href= "http://www.youtube.com/user/DianiBeachKenya" target="_blank"><img src= "http://villasdiani.com/wp-content/uploads/2013/02/youtube.png" /></a></div>
</div>

任何帮助将不胜感激!提前致谢!

最佳答案

div 是 block 元素,因此每个 div 将跨越整行。
要并排放置 div,只需删除它们的 block 属性。

.container .container DIV { width: 15px; margin: 1px; display:inline-block; }

关于css - 对齐 Div,表格样式,用于社交媒体图标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14660487/

相关文章:

javascript - 如何用jquery改变背景图片

jquery - 调整浏览器(谷歌浏览器)大小时 CSS Float 的奇怪行为?

wpf - 模糊的 XAML 矢量图形

html - 希望删除空白空间(使用 HTML)

html - meteor css 动画与之前/之后

objective-c - 将徽章添加到 Finder 中的文件图标

java - 使用图形的 jlabel 中文本之间的图标

html - 阻塞 css 资源。这会导致延迟呈现您的页面

html - 如何在 CSS 和 HTML 上安排文本的顺序

html - 添加border-top时如何让元素保持不向下移动