开发者

whats the best way to style a background image on a textbox ex:searchbox

I've done this before but for some reason im trying to right now and im using fieldset to display the background image and i can only get it to look nice in firefox. Whats a good cross-browser solution to adding a background image to a textbox.

example i was trying

<div class="subscribe">
                <form method="ge开发者_如何学运维t" id="searcform" action="">
                    <fieldset class="search">
                        <input type="text" class="box" value="Subscribe to Email Newsletter" />
                        <button class="btn" title="Subscribe">Subscribe</button>
                    </fieldset>
                </form>
            </div>


I'm not sure precisely what element you mean, but the following should work:

input[type=text],
textarea {
    background: #fff url(path/to/image.png) 0 0 no-repeat;
}


Simply make your input transparent and place inside a container div.

Example: http://jsfiddle.net/LRWWH/

Cross browser friendly.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜