I\'m trying to make a search bar that will look nice. What I did is, I made an image of an search bar and I\'m adding the image to the back-ground of the input and I\'m edit
Assuming you're talking about "Cancel search" [X] icon that appeas in Webkit browsers only (Chrome, Safari, Opera) you can use -webkit-search-cancel-button pseudo-element. E.g:
#Search::-webkit-search-cancel-button{
position:relative;
right:20px;
}
Demo: http://jsfiddle.net/5XKrc/1/
Screenshot:
Using this approach you can even create your own cancel button, for example this style:
#Search::-webkit-search-cancel-button{
position:relative;
right:20px;
-webkit-appearance: none;
height: 20px;
width: 20px;
border-radius:10px;
background: red;
}
Instead of [X] will create a red circle.
Demo http://jsfiddle.net/5XKrc/3/
Screenshot:
For IE10 and above you can use following to move the button:
#Search::-ms-clear{
margin-right:20px
}
Oh and do use placeholder="Search"
instead of value="Search"
- it will display word "search" when input is empty - and will automatically remove it when user types something.