Question

I am trying to use the Typeahead.js from Twitter. Everything looks and works great, Except for the TextBox being about 11 pixels below the expected start point.

I styled the component as suggested in the documentation.

.tt-dropdown-menu {
    width: 280px;
    margin-top: 12px;
    padding: 8px 0;
    background-color: #fff;
    border: 1px solid #ccc;
    -webkit-border-radius: 8px;
    -moz-border-radius: 8px;
    border-radius: 8px;
    -webkit-box-shadow: 0 5px 10px rgba(0,0,0,.2);
    -moz-box-shadow: 0 5px 10px rgba(0,0,0,.2);
    box-shadow: 0 5px 10px rgba(0,0,0,.2);
}

.tt-suggestion {
   padding: 3px 20px;
   font-size: 18px;
   line-height: 24px;
}

.tt-suggestion.tt-is-under-cursor {
    color: #fff;
    background-color: #0097cf;
}

.tt-suggestion p {
    margin: 0;
}

Could someone help with the styling of the typeahead component ?

Was it helpful?

Solution

I figured out the solution. Posting in the hopes of someone else encountering this issue.

The default html genereated by this component has style set to 'inline-block'. This was pushing it down to another row. having a style element for typeahead with display set to inline fixed this.

.tt-suggestion {
    display: inline;
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top