当文本超过高度时,文本区域背景图像滚动

发布于 2024-09-05 21:34:33 字数 133 浏览 2 评论 0原文

我正在尝试解决 IE7 中的问题。

我的文本区域后面有一个背景图像,当文本超过文本区域的高度并开始随文本滚动时,背景图像会随文本滚动。

任何人都知道为什么会发生这种情况以及解决方案是什么?

谢谢, 詹姆斯

I am trying to resolve an issue in IE7.

My text area has a background image behind it which then scrolls with the text when the text exceeds the height of the text area and begins to scroll with the text.

Anyone know why this is happening and what the solution this would be?

Thanks,
James

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

‖放下 2024-09-12 21:34:33

这是 IE 6 和 7 才会出现的问题,在 IE8 中已得到解决。

要解决此问题,请尝试将

您可能仍然需要调整

的边距和填充。和

This is a problem that only happens with IE 6 and 7, which has been resolved in IE8.

To fix the problem, try wrapping the <textarea> in a <div>. Apply the background and border properties of the <textarea> to the <div>, then set the border and background of the <textarea> to none.

You'll probably still need to tweak the margin and padding of both the <div> and the <textarea> to get it look just right, but now you should be pointed in the right direction.

幸福丶如此 2024-09-12 21:34:33

您是否尝试过将 background-position 设置为 background-position :顶部中心;
(或者类似background-position: 50px center;。)

Have you tried setting the background-position to background-position: top center;?
(Or something like background-position: 50px center;.)

來不及說愛妳 2024-09-12 21:34:33

使用:

textarea { background: transparent url(/images/test-bg.jpg) no-repeat top left; width: 500px; height: 230px; }

应该为您提供一个固定在文本区域框左上角的背景图像,当文本超过初始尺寸时该背景图像固定。

Using:

textarea { background: transparent url(/images/test-bg.jpg) no-repeat top left; width: 500px; height: 230px; }

should give you a background image that is fixed to the top left of the textarea box that is fixed when the text exceeds the initial dimensions.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文