2

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;

}
user2206329
  • 2,792
  • 10
  • 54
  • 81

3 Answers3

5

Simply do this:

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

Remove the space between CSS class selectors.

OnaBai
  • 40,767
  • 6
  • 96
  • 125
4

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.

RayLoveless
  • 19,880
  • 21
  • 76
  • 94
1

For me in 2020, the answer was simply:

.k-autocomplete {
    width: 300px;
}
Michael K
  • 822
  • 11
  • 13