how to set kendo ui autocomplete width with css?

淺唱寂寞╮ 提交于 2019-12-11 01:14:22

问题


How can I set the width of an autocomplete using css? I know I can set it up when I set up the width when I declare it, like so.

@(Html.Kendo().AutoComplete().Name("test").HtmlAttributes(new { style="width:400px"}))

But I want to know how to do it in css. I tried the following and it didn't work

 .k-autocomplete .k-header
{
    width: 300px;

}

回答1:


Simply do this:

.k-autocomplete.k-header {
    width: 300px;
}

Remove the space between CSS class selectors.




回答2:


Taken from their documentation

var autoComplete = $("#autoComplete").data("kendoAutoComplete");

// set width of the drop-down list
autoComplete.list.width(400);

Seems a bit odd that this isn't part of the configuration when you initialize.. maybe that's just me.



来源:https://stackoverflow.com/questions/16857981/how-to-set-kendo-ui-autocomplete-width-with-css

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!