使用带输入的Sprite图像 [英] Using a Sprite image with input

查看:112
本文介绍了使用带输入的Sprite图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否可以使用一个sprite,其中每个图像是16 x 16作为一个输入text / textarea的大约300px的背景。

I am wondering if it is possible to use a sprite where each image is 16 x 16 as a background to an input text/textarea which is around 300px. Anyone know a way or should I just slice them into different backgrounds.

推荐答案

您的需求可能是对角线CSS Sprites

你可以在一个变量或更大的上下文中使用sprite作为背景图片,而不必担心sprite显示的其他图形。

The idea is that you can use the sprite as a background image in a variable or larger-sized context without fear of other graphics in the sprite showing up.

为什么是对角线Sprite?

对角线上的sprite在你所显示的组件的下方或右侧没有组件。这允许使用sprite的元素宽度或高度,因为它不需要担心暴露下一个组件。

With the sprite built on a diagonal there are no components below or to the right of the component you are showing. This allows for the element using the sprite to be as wide or as tall as it needs to be with no worry of exposing the next component.

当然,这个是以更大的精灵文件大小为代价的,因为额外的空白空间,但是灵活性通常值得文件大小权衡。

Naturally, this is at the cost of a larger sprite file size because of the extra white space, however the flexibility is usually worth the file size tradeoff.

这篇关于使用带输入的Sprite图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆