Ideally I would like this to work for Mac Chrome and Firefox. How do I style a DIV such that it takes up horizontal space equal to the width of its elements but not more? Right now I have
<div id="searchContainer">
Enter Search Criteria To Lookup Results:<br>
<div id="search_form">
<form id="search-form" action="/users/lookup_races" accept-charset="UTF-8" method="get"><input name="utf8" type="hidden" value="✓">
<input type="text" name="first_name" id="first_name" placeholder="First Name">
<input type="text" name="last_name" id="last_name" placeholder="Last Name">
<input type="text" name="item" id="item" placeholder="Item" size="50">
<input alt="Search" type="image" src="/assets/magnifying-glass-0220f37269f90a370c3bb60229240f2ef2a4e15b335cd42e64563ba65e4f22e4.png" class="search_button">
</form></div>
</div>
and the styles are
#searchContainer
{
padding: 10px;
font-family: "Calibre", "Helvetica Neue", "Helvetica", "Roboto", "Arial", sans-serif;
background-color: tan;
}
#search_form
{
display:table-cell;
padding: 0px;
}
#search_form form input
{
vertical-align:middle;
}
This is illustrated in the JSFiddle here — https://jsfiddle.net/jzz6y71t/1/ . Notice that the DIV takes up the entire horizontal space of the parent container but I’d like it to only be as long as what the width of the elements are.