【发布时间】:2018-05-23 14:11:12
【问题描述】:
我的代码中有一个来自第三方库的 angular-5 下拉组件,该组件有自己的 CSS,由于它的默认行为,我无法更改它的 CSS(这里我试图减小下拉列表的宽度) ,我也尝试使用编写另一个 css 类和内联样式,但它不会改变宽度。
HTML 代码,我在其中控制了我的代码:(第 3 方下拉组件)
<test-dropdown id="dropdown" label="Options Array"
[selectedOption]="dropdownOptions[0]">
<test-option *ngFor="let option of dropdownOptions"
[option]="option" [disabled]="option.disabled">{{option.label}}
</test-option>
</test-dropdown>
上面的下拉组件,在浏览器中运行应用程序后的样子,
<test-dropdown _ngcontent-c4="" id="dropdown" label="default" ng-reflect-label="default">
<div class="test-dropdown" ng-reflect-ng-class="[object Object]">
<label>DropDown</label>
<div>
<button class="select">Select...</button>
<div class="dropdown">
<!--bindings={
"ng-reflect-ng-for-of": "[object Object],[object Object"
}-->
<test-option _ngcontent-c4="" class="dropdown-btn-vp option ng-star-inserted" style="min-width: 120px"
ng-reflect-option="[object Object]">
<button class="option">
Option One
</button>
</test-option>
<test-option _ngcontent-c4="" class="dropdown-btn-vp option ng-star-inserted" style="min-width: 120px"
ng-reflect-option="[object Object]">
<button class="option">
Option Two
</button>
</test-option>
<!--bindings={}-->
</div>
</div>
</div>
</test-dropdown>
简而言之,我想在类 test-dropdown->button.select 和 test-dropdown->div.dropdown
上应用 css 样式【问题讨论】:
标签: angular css bootstrap-4 angular-ui-bootstrap angular5