简体   繁体   English

HTML 对齐下拉元素

[英]HTML align dropdown elements

I want to insert custom element(not a simple link ) to drop down.我想插入自定义元素(不是简单的链接)来下拉。 Here is my code:这是我的代码:

    <div class="container">
    <div class="btn-group" dropdown is-open="status.isopen">
        <button id="single-button" type="button" class="btn btn-primary" dropdown-toggle ng-disabled="disabled">
            Button dropdown <span class="caret"></span>
        </button>
        <ul class="dropdown-menu" role="menu" aria-labelledby="single-button">
            <li role="menuitem"><a href="#">Action</a></li>
            <li role="menuitem">
                <div style="display:block">
                    <span>Action</span>
                    <button type="submit" class="invisible-input pull-right"><i class="fa fa-check-circle-o fa-lg"></i></button>
                    <button type="submit" class="invisible-input pull-right"><i class="fa fa-times-circle-o fa-lg"></i></button>
                </div>
            </li>
            <li role="menuitem"><a href="#">Something else here</a></li>
            <li class="divider"></li>
            <li role="menuitem"><a href="#">Separated link</a></li>
        </ul>
        </ul>
    </div>
</div>

I faced problem, that I cannot align label of Item like another ones.我遇到了问题,我无法像其他标签一样对齐 Item 标签。 Maybe someone can give me a helping hand to make strings in drop down aligned.也许有人可以帮助我使下拉列表中的字符串对齐。

Here is a picture what I get:这是我得到的图片: 在此处输入图片说明

I use angular, bootstrap and bootstrap-UI.我使用 angular、bootstrap 和 bootstrap-UI。

Fiddle link: http://jsfiddle.net/dJDHd/1165/小提琴链接: http : //jsfiddle.net/dJDHd/1165/

Should be a simple addition to your custom CSS file:应该是对自定义 CSS 文件的简单添加:

.dropdown-menu > li > div {
    padding: 0 20px;
}

Demo演示

Demo 2 (Fork of OP's code - thanks Manoj Kumar )演示 2 (OP 代码的分支- 感谢Manoj Kumar

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM