Reputation: 5
Im new to CSS and HTML and learning html forms right now. I was wondering if it is possible to put a submit button within the text field. Much like how google has their voice search button in their search field.
and if so, how do i do this?
Thanks
Upvotes: 0
Views: 1976
Reputation: 851
Here is an example: http://jsfiddle.net/fatgamer85/9R2XC/
You need to put the element in absolute position and lay it on top of each other.
position: absolute; // absolute position of element
left: -20px; // lay the element on the search box
hope this helps
Upvotes: 1
Reputation: 71150
You cant put it within the element so to speak, but you can position it
HTML
<input type='text' />
<input type='submit' value='GO'/>
CSS
input{
display:inline-block;
position:relative;
}
input:last-child{
left:-40px;
}
Note that this is just one of the ways you can create this effect (you dont have to use a submit input element for example).
Upvotes: 0