开发者

Textarea background-position fixed problem

I've been searching for a solution for a few hours now, but nothing seems to work.

I have this <textarea> with some text and a scroll bar on the right.

<textarea rows="1" style="background: url(http://i35.tinypic.com/4tlkci.jpg) fixed no-repeat;">

The problem is that the background image scrolls with the scroll, when it should stay fixed. Safari and Firefox seem to fail on this one.

Maybe someone开发者_StackOverflow中文版 could show me the right way to use this or maybe post some example where the background image stays FIXED while you scroll.

Is using a background image for a textarea is considered being a bad example?


Seems to work on all browsers I try on:

http://jsfiddle.net/V4TCP/

If all else fails, you can always make it transparent and put it over a div:

<div style="background: url(http://i35.tinypic.com/4tlkci.jpg) fixed no-repeat;">
    <textarea rows="1" style="background: transparent"></textarea>
</div>
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜