PDA

View Full Version : Button with text and iconCls with image from css sprite shows adjacent images



devtig
4 Jan 2011, 6:50 AM
When a button with text and a iconCls that uses an image from a CSS sprite, the horizontally adjacent sprite images are also shown. I use this code to create my button.


<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>test</title>
<link rel="stylesheet" type="text/css" href="http://extjs.cachefly.net/ext-3.3.1/resources/css/ext-all.css"/>
<link rel="stylesheet" type="text/css" href="/silk/css/sprite.css"/>
<script type="text/javascript" src="http://extjs.cachefly.net/ext-3.3.1/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="http://extjs.cachefly.net/ext-3.3.1/ext-all-debug.js"></script>
<script type="text/javascript">
Ext.onReady(function() {
Ext.BLANK_IMAGE_URL = 'http://extjs.cachefly.net/ext-3.3.1//resources/images/default/s.gif';
var vp=new Ext.Viewport({
layout: 'fit',
renderTo: Ext.getBody(),
items: [{
xtype: 'panel',
tbar: [{
xtype: 'button',
iconCls: 'ss_section_expanded',
text: 'colapse'
}]
}]
});
});
</script>
</head>
</html>


I know I could solve it with a sprite with a single column of images. But I wonder if there's a way to solve it with this sprite (images horizontally). When the image would be contained in it's own element somehow, the problem would be solved also.