设置 igx-select 的宽度
我有多个用于显示下拉列表的 igx-selects。
我想更改此特定 igx-select 的宽度(不适用于我拥有的所有 igx-selects)以及列表的字体大小。当我尝试时,没有任何效果。这在SCSS中可能吗?
这是我的 igx-select 块。
<igx-select #selectCity
placeholder="Select city"
[overlaySettings]="overlaySettings"
[(ngModel)]="city" name="cities">
<igx-select-item style="width: 430px" *ngFor="let item of cities" [value]="item">
{{ item }}
</igx-select-item>
</igx-select>
非常感谢!
I have multiple igx-selects
that are used to display a drop-down list.
I want to change the width of this particular igx-select
(not for all igx-selects
that I have) as well as the font-size of the list. As I tried nothing worked. Is this possible in SCSS?
Here is my igx-select
block.
<igx-select #selectCity
placeholder="Select city"
[overlaySettings]="overlaySettings"
[(ngModel)]="city" name="cities">
<igx-select-item style="width: 430px" *ngFor="let item of cities" [value]="item">
{{ item }}
</igx-select-item>
</igx-select>
Thank you very much!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
IgxSelect 的宽度取决于其父容器的宽度。如果你想改变 igxSelect 的宽度,你应该像这样设置它的父级的宽度:
如果你需要设置选择下拉列表的宽度,这有点棘手。实现此目的的一种方法是处理选择的
opening
事件。在处理程序中,您可以设置选择切换元素的宽度,这是下拉列表,如下所示:请记住,这可能会破坏选择下拉列表的定位。可以通过应用于项目本身的 CSS 来设置所选项目的字体,如下所示:
同样,这可能会破坏所选项目的定位。设置项目大小的一种方法是通过 DisplsyDensity。
IgxSelect's width depends on the width of its parent container. If you want to change the width of igxSelect you should set the width of its parent like this:
If you need to set the width of the select's dropdown this is a little more tricky. One way to achieve this is to handle
opening
event of the select. In the handler you can set the width of the select toggle element, this is the dropdown, like this:Keep in mind this may brake the positioning of the select dropdown. Setting of the font of the select items could be done via CSS applied to the item itself like this:
Again this may break the positioning of the select items. One way to set the size of the items is via
DisplsyDensity
.