JSFiddle - React, Tailwind, and code Playground
HTML
<div id="searchContainer">
<h1>Search For Race Results:</h1>
<form id="search-form" action="/races/search" accept-charset="UTF-8" method="get"><input name="utf8" value="✓" type="hidden">
<input name="first_name" id="first_name" value="Dave" placeholder="First Name" type="text">
<input name="last_name" id="last_name" value="" placeholder="Last Name" type="text">
<input name="event" id="event" value="" placeholder="Event" type="text">
<input alt="Search" src="http://www.racertracks.com/assets/magnifying-glass-0220f37269f90a370c3bb60229240f2ef2a4e15b335cd42e64563ba65e4f22e4.png" class="search_button" type="image">
</form></div>
CSS
#searchContainer {
padding: 10px;
font-family: "Calibre", "Helvetica Neue", "Helvetica", "Roboto", "Arial", sans-serif;
background-color: tan;
max-width: 1000px;
width: 100%;
display: inline-block;
-webkit-box-flex: 1;
-ms-flex: 1 0 auto;
flex: 1 0 auto;
box-sizing: border-box;
}
/* line 132, /Users/davea/Documents/workspace/runtrax/app/assets/stylesheets/events.css.scss */
#searchContainer h1 {
margin: 5px 0;
font-size: 1.0em;
}
/* line 137, /Users/davea/Documents/workspace/runtrax/app/assets/stylesheets/events.css.scss */
#search-form {
display: -webkit-inline-box;
display: -ms-inline-flexbox;
display: inline-flex;
/*In screen >400px input element will be inline*/
width: 100%;
}
#first_name,
#last_name {
width: 40%;
/*make the width like event so all the input fields looks good*/
}
#event {
width: 100%;
}
#last_name,
#event {
margin-left: 2px;
}
#event {
margin-right: 2px;
}
input.search_button {
/* Search-button will be center when meda screen < 400px */
-ms-flex-negative: 0;
flex-shrink: 0;
}
@media only screen and (max-width: 400px) {
/*set the max width 400px so they will wrap after the media screen reach 400px*/
#search-form {
-ms-flex-wrap: wrap;
flex-wrap: wrap;
}
#first_name {
width: calc(50% - 8px);
margin: 0;
}
#last_name {
width: calc(50% - 8px);
margin-left: 2px;
}
#first_name,
#last_name {
margin-bottom: 1px;
}
#event {
width: calc(100% - 35px);
margin-right: 2px;
}
}