如何使用CSS显示部分图片 [英] How To Show Part of Picture With Css
问题描述
亲爱的朋友们
我想显示图片的一部分
但我不知道怎么做!
仅不用于OverFolw:Hidden;
非常感谢
hi Dear my Friends
i want to show part of picture
but i dont Know how!!!
only not using with OverFolw:Hidden;
thanks very much
推荐答案
jQuery UI做到了这一点.您可以查看一下.例如,这来自jQuery ui的主题文件
jQuery UI does this very well. You could look in to that. For example this is from the jQuery ui''s theme file
/* states and images */
.ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_222222_256x240.png); }
/* positioning */
.ui-icon-carat-1-n { background-position: 0 0; }
.ui-icon-carat-1-ne { background-position: -16px 0; }
.ui-icon-carat-1-e { background-position: -32px 0; }
注意宽度& ui-icon类中的高度和位置"部分中的background-position属性.
例如,要使用ui-icon-carat-1-n类,可以执行以下操作:
Note the width & height in the ui-icon class and background-position attribute in the "positioning" section.
For example to use ui-icon-carat-1-n class the following could be done:
<span class="ui-icon ui-icon-carat-1-n" style="display:inline-block"></span>
请参阅此SO问题,其中讨论了有关使用jQuery UI图标的问题:
http://stackoverflow.com/questions/7290857/using-jquery-ui-icons [ ^ ]
Refer to this SO question which discusses about using jQuery UI icons:
http://stackoverflow.com/questions/7290857/using-jquery-ui-icons[^]
这篇关于如何使用CSS显示部分图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!