Javascript Extjs 3.4-按钮图标不显示或不居中
我想用我创建的图标填充一个按钮,但无论我尝试了什么,似乎都只是将图标半切左移,或者根本不显示。我一直在尝试CSS和图标、图标、cls按钮选项的不同组合 我是按照ext3按钮,但似乎没有显示任何东西给我Javascript Extjs 3.4-按钮图标不显示或不居中,javascript,html,css,button,extjs,Javascript,Html,Css,Button,Extjs,我想用我创建的图标填充一个按钮,但无论我尝试了什么,似乎都只是将图标半切左移,或者根本不显示。我一直在尝试CSS和图标、图标、cls按钮选项的不同组合 我是按照ext3按钮,但似乎没有显示任何东西给我 This code is an item inside my form panel (I try to replicate this with different buttons in the panel) { xtype: 'container',
This code is an item inside my form panel (I try to replicate this with different buttons in the panel)
{
xtype: 'container',
layout: {
type: 'table',
columns: 2,
tableAttrs: {
cellspacing: 5
}
},
// padding: 5,
pack: 'center',
align: 'middle',
items: [{
xtype: 'button',
width: 40,
// scale: 'medium',
ref: '../drawToolsBtn',
tooltip: 'Drawing Tools',
icon: 'img/draw.png',
iconAlign: 'top',
baseCls: 'x-plain',
// iconCls: 'drawBtn',
enableToggle: true,
// padding: 3,
toggleHandler: function(btn, state)
{
this.showDrawToolsWin(state);
},
scope: this
},{
xtype: 'label',
// columnWidth: 1, // remainder of container
padding: 3,
text: 'Click button to open Drawing Tools Menu'
}]
}
CSS
--------------------
.drawBtn{
background: url(../img/draw.png) !important;
}
谢谢你的帮助 代码似乎是正确的。验证图标的路径。您在firebug控制台中是否看到任何ajax故障?如果我在正确显示的按钮中添加一个文本:“DRAW”(图标居中于按钮中),图标将被检索。。如果没有,就好像图标被限制在按钮的左半部分。试试这个。drawBtn{background:url(../img/draw.png)居中右不重复!重要;}没有显示任何内容。。如果我删除文本选项,按钮将为空。示例显示背景图像:url(../img/draw.png)!重要的;在您的代码中,它只是背景。。!!是的,我已经尝试了几十种配置。当我设置了文本选项时,css工作得很好,但仅此而已。
.drawBtn{
background-image: url(../img/draw.png) !important;
}