设置 ng-multiselect-dropdown 的宽度

set width of ng-multiselect-dropdown

我正在使用 ng-multiselect-dropdown。我想将其宽度设置为 100pt。

我已经尝试使用一些 css

.multiselect-dropdown {
    widht:100pt;
}
.multiselect-dropdown .dropdown-btn {
    widht:100pt;
}

我定义了自定义 class 并给出了宽度。但要注意的是!important应用。它覆盖 ng-multiselect 的现有 css,其中宽度定义为 100%。

CSS

.custom-font-size .multiselect-dropdown .dropdown-btn {
    width: 100pt !important; 
}

HTML

<ng-multiselect-dropdown #reporteedropDown class="custom-font-size....">
</ng-multiselect-dropdown>

您可以参考以下代码:

CSS

::ng-deep .multiselect-dropdown .dropdown-btn {
    width: 97%;
}

更新 ng-multiselect-dropdown 的样式 : 首先在多选中添加你的 own/custom class 然后使用这个 class 作为父选择器

html

<ng-multiselect-dropdown
   class="customClass"
   [settings]="dropdownSettings"
   [data]="dropdownList"
   (onSelect)="onItemSelect($event)" 
   (onSelectAll)="onSelectAll($event)">
 </ng-multiselect-dropdown>

css

.customClass.dropdown-btn{
    width: 50% !important;
    border:1px solid red !important;
}