I’m trying to create a search input text with a side by side button.
Here are the requirements:
- [1] Those elements should be absolute centered. Both vertical and horizontal.
[2] The solution should work on IE8+ and good browsers.
[3] In the browser default font-size is bigger, no text or graphic element should be hidden or misplaced on the user browser.
This is what I have so far, on latest Chrome and Firefox browsers:
Here’s on Chrome:
Here’s on FF:
I believe I have no issues with vertical align part. Using pseudo-element height: 100%; with display: inline-block; technique.
I do have issues however, on placing the button element, side by side with the input text field, without any white gaps around.
The CSS relevant part:
.search-form {
display: inline-block;
border: 5px solid red;
background: #fff;
}
.search-form input {
font-size: 1.3em;
height: 50px;
border: none;
}
.search-form button {
border: none;
background-color: red;
height: 50px;
vertical-align: top; /* no dice */
cursor: pointer;
}
The HTML:
<div id="main-wrapper">
<div id="search-wrapper">
<h3>Hello there</h3>
<form action="" class="search-form">
<input type="text" name="lorem" />
<button type="submit">
<span>Search</span>
<!-- should be a place to background image or icon font symbol. -->
</button>
</form>
</div>
</div>
The fiddle:
I’m taking my (not that much) hair off!
Can I have your help?