gpt4 book ai didi

html - 如何将 CSS Sprite 与文本框一起使用?

转载 作者:太空宇宙 更新时间:2023-11-04 13:26:09 25 4
gpt4 key购买 nike

我正在尝试在文本框中使用 CSS Sprite 。图片尺寸为 200x50 像素,我只想显示图片的一部分,假设从 (25px,25px)(x,y 坐标) 开始,高度为 30px,宽度为 50px。

.img_textbox
{
background-image: url(images/ff.jpg);
background-position: 25px 25px;
background-repeat: no-repeat;
height: 30px;
width: 50px;
}

上述坐标由第三个值决定,因此根据文本框中的文本而变化。

<input type="textbox" name="type" class="img_textbox" value="">

我尝试使用 background-position 和 background-image 属性,但在我的情况下没有用。

我该怎么做?我应该使用哪些属性或标签来使其工作?请指导我...

提前致谢..

最佳答案

我不确定是否存在有效的 <input type="textbox"> , 你最好使用 <textarea> .

CSS:

textarea.img_textbox {
background-image: url(images/ff.jpg);
background-position: 25px 25px;
height: 30px;
width: 50px;
}

html:

<textarea class="img_textbox" cols="5" rows="3">
// value
</textarea>

关于html - 如何将 CSS Sprite 与文本框一起使用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6476675/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com