I want to use the twitter bootstrap icons on my form input submit buttons.
The examples on http://twitter.github.com/bootstrap/base-css.html#icons mainly show style
There is one way, how to get (bootstrap's) glyphicons into input type="submit"
. Using css3 multiple background.
HTML:
and CSS:
.form-search input[type="submit"] {
padding-left:16px; /* space for only one glyphicon */
background:-moz-linear-gradient(top,#fff 0%,#eee 100%) no-repeat 16px top,
url(../images/glyphicons-halflings.png) no-repeat -48px 0,
-moz-linear-gradient(top,#fff 0%,#eee 100%); /* FF hack */
/* another hacks here */
background:linear-gradient(to bottom,#fff 0%,#eee 100%) no-repeat 16px top,
url(../images/glyphicons-halflings.png) no-repeat -48px 0,
linear-gradient(to bottom,#fff 0%,#eee 100%); /* Standard way */
}
If multiple backgrounds are overlaping, at the top will be first background at the background:
notation.
So at the top is background which is indented 16px
from left side (16px
is width of single glyphicon), at the bottom level is whole glyphicons-halflings.png
and at the bottom level (covers whole element) is same background gradient as at the top level.
-48px 0px
is the cut for search icon (icon-search
) but it's easy to show any other icon.
If someone need a :hover
effect, background must be again typed at the same form.