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

时间:2012-04-03 17:36:52

标签: html css layout twitter-bootstrap

我正在尝试使用twitter bootstrap来创建Facebook,就像工具提示布局一样。

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

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

enter image description here

1 个答案:

答案 0 :(得分:15)

这是我使用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>​
相关问题