html - 如何使用 Twitter Bootstrap 创建类似 Facebook 的工具提示布局?

标签 html css layout twitter-bootstrap

我正在尝试使用 twitter bootstrap 来创建类似 Facebook 的工具提示布局。

如果有人能让我知道如何使用 twitter bootstrap 来创建此布局,我将不胜感激,我不需要它作为工具提示,我需要它在常规 div 中。

我附上了代表我正在寻找的图片。

enter image description here

最佳答案

这是我使用 Twitter Bootstrap 框架对该框的看法。不得不修改一些跨度宽度以符合您的图像尺寸,但我使用了一个 id 来定位它们,这样它们就不会在您的页面设计中打扰其他 span* 类。

我把它放在 jsFiddle 上,因为它有相当多的代码,所以检查一下:demo在这里,编辑 here .

CSS:

body {
    margin:50px;
}

#box {
    border: 1px solid #92959C;
    width:290px;
    padding-top: 10px;
    -webkit-border-radius: 2px;
    -moz-border-radius: 2px;
    border-radius: 2px;
    -moz-background-clip: padding; -webkit-background-clip: padding-box; background-clip: padding-box;
    -webkit-box-shadow: 0px 0px 4px 0px #ccc;
    -moz-box-shadow: 0px 0px 4px 0px #ccc;
    box-shadow: 0px 0px 4px 0px #ccc;

}

#box .row {
    margin-left: -10px;
}

#box [class*="span"] {
    margin-left: 10px;
}

#box .span0 {
    width:32px;
    margin-left:1px;
}

#box li.span0:first-child {
    margin-left: 0;
}

#box .span1 {
    width: 96px;
}

#box .span2 {
    width:165px;
    margin-left:10px;
}

#box .span2 p, .span2 a {
    font-size:12px;
    margin:0;
}

#box .span2 h4 {
    font-size:13px;
    line-height:10px;
}

#box .span1 img {
    width:96px;
    height:96px;
}

#box .img-list {
    margin:0;
    padding:0;
    list-style:none;
}

#box-footer {
    margin-top:10px;
    width:290px;
    border-top:1px solid #aaa;
}

.gray {
    background-color:#F2F2F2;
    padding:10px 10px 20px;
    min-height:20px;
}
​

HTML:

<div class="container">
    <div class="row">
        <div id="box" class="span4">
            <div class="span1">
                 <img alt="" src="http://placehold.it/96x96">
            </div>
            <div class="span2">
                <h4>Omer</h4>
                <p class="muted">AI Lead at New brand analytics</p>
                <a href="#">64 mutual friends</a>
                <ul class="img-list">
                    <li class="span0">
                        <img alt="" src="http://placehold.it/32x32">
                    </li>
                    <li class="span0">
                        <img alt="" src="http://placehold.it/32x32">
                    </li>
                    <li class="span0">
                        <img alt="" src="http://placehold.it/32x32">
                    </li>
                    <li class="span0">
                        <img alt="" src="http://placehold.it/32x32">
                    </li>
                    <li class="span0">
                        <img alt="" src="http://placehold.it/32x32">
                    </li>
                </ul>
            </div>
            <div class="row">
                <div id="box-footer" class="span4">
                    <div class="gray">
                        <a href="#" class="btn pull-right">Friends</a>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>​

关于html - 如何使用 Twitter Bootstrap 创建类似 Facebook 的工具提示布局?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9998462/

相关文章:

css - 在 Meteor.js 中使用自定义 bootstrap3 主题

php - 如何从公共(public)布局文件中的数据库获取和显示数据并显示在 laravel 5.2 中的所有 View 上

jquery - 我可以在 div 上使用自定义属性吗?

javascript - 使用css/js切换黑白图像的颜色

html - 如何用表格在html中分页

html - 最大宽度的div不占用最大宽度

html - 为什么我的列表元素超出了 1px?

javascript - 通过搜索从 JSON 填充表

html - 使用 float 后的 CSS 定位

internet-explorer - IE10 中的关键帧动画问题