代码之家  ›  专栏  ›  技术社区  ›  kayasa

减少项目之间的间距-多选下拉列表

  •  0
  • kayasa  · 技术社区  · 7 年前

    我正在使用 https://github.com/softsimon/angular-2-dropdown-multiselect 在angular 4中创建多选下拉列表。

    .dropdown-menu>li>a {
        display: block;
        padding: 3px 20px;
        clear: both;
        font-weight: 400;
        line-height: 1.42857143;
        color: #333;
        white-space: nowrap;
    }
    

    有没有一种方法可以在项目上应用自定义CSS来消除填充。如果我覆盖“下拉菜单”>李>在我的CSS中有一个“a”,那么它也会影响其他元素

    .dropdown-menu>li>a {
        display: block;
        padding: 1px 5px;
        clear: both;
        font-weight: 400;
        line-height: 1.42857143;
        color: #333;
        white-space: nowrap;
    }
    

    Elements with spacing

    用黑色突出显示的区域是我想去掉的whitepsace。

    1 回复  |  直到 7 年前
        1
  •  2
  •   Srichandradeep C    7 年前

    您必须重写样式,但确保将其包装在另一个类中,以便仅在该类中应用。

    例如: HTML:

    <div class="customDropdown">
     //Use drop down here
    </div>
    

        .customDropdown .dropdown-menu>li>a {
            display: block;
            padding: 1px 5px;
            clear: both;
            font-weight: 400;
            line-height: 1.42857143;
            color: #333;
            white-space: nowrap;
         }