There are several ways to achieve this, with varying degrees of success, depending on the method used:
@Muhammad's option of using display: inline-block;
on the inputs and forcing the container to ignore text-wrapping with white-space: no-wrap;
does work to acheive your goal of forcing everything on one line;
However, it's a limited solution in that your elements will be whatever default size dictated by the browser and because the containers will be over-sized and out of position on some devices/resolutions/window sizes, etc. (ultimately, the user experience wasn't addressed)
The Flex-box CSS implementation is also another way to go, and browser implementation is getting much closer to the point that it'll be the solid option in the future, and yes, it can be fairly-well implemented in many browsers with certain CSS fallback and/or Javascript Shims (perhaps provided by a framework, etc), but assuming you want bullet-proof coverage that just works, use a little math to calculate some percentage widths, use floats, and add a dash of media queries to achieve your objective:
Here's the CSS and notes to do this, below,
and Here's the Fiddle to try it out. (I've set the container color to change with the breakpoints, so try resizing your window.)
/* Control the box-model: (makes assigned widths predictable) */
* { box-sizing: border-box; }
#loginArea {
border-radius: 25px;
font-family: 'russo_oneregular';
font-size: 20px;
padding: 20px;
background-color: #000000;
color: #ffffff;
position: absolute;
top: 50%;
left: 50%;
transform: translateX(-50%) translateY(-50%);
}
/* Default Styles (at full width)
Assign calculable sizes to the form fields:
We have 3 fields (1 double-sized) and a button:
So, 1+1+2+1 = 5; Dividing 100% container-width by 5 = 100/5 = 20%;
we need spacing between (think margin-right),
so, shave each element down 1% and set the margin-right to 1%;
then specifically set the double-width entry separately (40% = 39% + 1%)
*/
#searchForm input {
float: left;
width: 19%;
margin: .25em 1% .25em 0;
}
#searchForm input#my_object {
width: 39%;
}
/* Applying Media Queries to give friendlier form layouts
by using alternative field sizes for better user experience
at different break-point sizes (indicated by varying background color */
/* Mobile Styles */
@media only screen and (max-width : 480px) {
#loginArea {background-color:red;}
/*Full-width, no margin, stacked; */
#searchForm input {
width: 100%;
margin-right: 0;
}
#searchForm input#my_object {
width: 100%;
}
}
/* Phablet (In-between-sized mobile styles)
-- in this case, same as mobile for consistency)
*/
@media only screen and (min-width : 481px) and (max-width : 767px) {
#loginArea {background-color:yellow;}
/*Full-width, no margin, stacked; */
#searchForm input {
width: 100%;
margin-right: 0;
}
#searchForm input#my_object {
width: 100%;
}
}
/* Tablet Styles */
@media only screen and (min-width : 768px) and (max-width : 1024px) {
#loginArea {background-color:green;}
/* Name side-by-side, Event stacked full-width below;
(Using 1% padding on both left and right, to keep things balanced)
*/
#searchForm input {
width: 48%;
margin: .25em 1%;
}
#searchForm input#my_object {
width: 98%;
}
}
#loginArea { /*position: absolute; top: 50%; left: 50%; transform: translateX(-50%) translateY(-50%);*/ }
– Hoofboundwhite-space: nowrap;
to the#loginArea
css rule. – Limassol