Trying to tackle this CSS challenge, but it's definitely been a head-scratcher for me.
I'm aiming to place two elements on the same line:
- Textbox
- Search icon image
The search icon should maintain its size regardless of width, while the textbox should occupy 100% of the available space (while still positioning the icon right next to it).
The issue I'm facing is depicted in this visual (the alignment is off due to the textbox taking up 100% width):
This is my current markup:
<div class="SearchBox">
<div class="searchDiv">
<div class="searchDivFullSpan">
<asp:TextBox runat="server" ID="SearchOnGoogleBox" Height="34px"></asp:TextBox>
</div>
<asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/Resources/Images/SearchIcon.png" OnClick="SearchBtn_Click" ToolTip="Search for content" Height="48px" OnClientClick="_gaq.push(['_trackEvent', 'Global_master', 'Search for content']);" />
</div>
</div>
This is the accompanying CSS:
.SearchInputBox {
border: 1px solid #C6D1AD;
font-size: 20pt;
background-color: #FAFAFA;
}
.searchDiv {
padding-top: 10px;
padding-left: 10px;
padding-right: 10px;
}
.searchDivFullSpan {
display: inline;
}
.searchDivFullSpan input[type=text] {
width: 100%;
}
.searchDiv input[type="text"] {
background-color: #f3f3e9;
-moz-border-radius: 5px;
border-radius: 5px;
}
Any helpful clues or suggestions would be greatly appreciated. Thank you!