Jquery autocomplete styling

后端 未结 2 933
无人共我
无人共我 2020-12-31 16:40

While styling the jQuery autocomplete plugin, I get the following HTML code hardwired to my page:

2条回答
  •  失恋的感觉
    2020-12-31 16:55

    jQuery autocomplete needs to set some inline styles to position the drop down list under the text box and size it equally.

    It doesn't set anything else, so it's completely up to you to provide visual styling of it by setting styles of those classes that are added to it (ie. ui-autocomplete).

    Advice

    What I'm trying to tell you is this: set the visual aspects of the drop down list that gets displayed and don't worry about positioning and sizing inline styles.

    Need to change positioning

    If you do need to override positioning and sizing of this element you can always set your styles as !important.

    ul.ui-autocomplete
    {
        position: absolute;
        left: 100px!important;
        top: 0!important;
        ...
    }
    

    Additional edit

    Setting margin-top doesn't do anything since it calculates position every single time it displays the drop down. But you can try setting this:

    .ui-autocomplete
    {
        border-top:5px solid transparent!important;
    }
    

    This actually does the trick.

提交回复
热议问题