带有div设计的Bootstrap 3自定义li元素

时间:2015-02-04 10:20:15

标签: html css twitter-bootstrap twitter-bootstrap-3

我在Bootstrap 3中使用自定义的li元素。 我想要的是类似的东西 -

1

我所做的是 -

HTML -

<ul class="list-group">
    <li class="list-group-item" id="baal">
        <div style="display: inline;">
            <div class="inline">
                Anything <img id="image_click" src="http://www.neatimage.com/im/lin_logo.gif">
            </div>

            <div class="inline">
                <img id="image_click" src="http://www.neatimage.com/im/lin_logo.gif">
            </div>


            <blockquote>
                <p>angulard it's obviously tremendously helpful to a lot of people - they took the time to search for a solution,</p>
            </blockquote>
            <div>
                More thing
            </div>
        </div>
    </li>
    <li class="list-group-item">
        <div class="inline">
            <div>
                1
            </div>
            <div>
                2
            </div>
        </div>

        <div class="divider-vertical"></div>

        <div class="inline">
            <div>
                3
            </div>
            <div>
                4
            </div>
        </div>
    </li>        
    <li class="list-group-item">Music</li>
    <li class="list-group-item">Videos</li>
</ul>

所以,div的HTML就像 -

<li class="list-group-item">
    <div class="inline">
        <div>
            1
        </div>
        <div>
            2
        </div>
    </div>

    <div class="divider-vertical"></div>

    <div class="inline">
        <div>
            3
        </div>
        <div>
            4
        </div>
    </div>
</li>

CSS是 -

/*  List Item Styling   */
div.inline
{
    float:left;
}

.divider-vertical
{
    height: 50px;
    margin: 0 9px;
    border-left: 1px solid #F2F2F2;
    border-right: 1px solid #FFF;
}
/*  End - List Item Styling */

但我得到的是 -

2

任何人都可以帮我解决这个问题吗?

提前感谢您的帮助。

1 个答案:

答案 0 :(得分:0)

使用.clearfix类如下:

<li class="list-group-item">
    <div class="inline">
        <div>
            1
        </div>
        <div>
            2
        </div>
    </div>

    <div class="divider-vertical"></div>

    <div class="inline">
        <div>
            3
        </div>
        <div>
            4
        </div>
    </div>
    <div class="clearfix"></div>
</li>  

的CSS:

/*  List Item Styling   */
div.inline, .divider-vertical   
{
    height: 50px;
    float:left;
}

.divider-vertical   
{
    margin: 0 9px;
    border-left: 1px solid #F2F2F2;
    border-right: 1px solid #FFF;
}