可以设置的 配置时有一个配置项
cls : String
一个可选添加的CSS样式类,加入到组件的元素上(默认为'')。这为组件或组件的子节点加入标准CSS规则提供了方便
用法实例:
<body><style type="text/css">
.myCls{
color: red font-size:20
}
</style>
<script type="text/javascript">
Ext.create('Ext.panel.Panel',{
items:[
{
xtype:'label',
text:'这里的文字是红色',
cls:'myCls'
}
],
renderTo:Ext.getBody()
})
</script>
</body>
在extjs4.0中修改背景颜色和字体可以用style配置选项:如下:
Ext.define 'App.your_package.CustomToolbar',
extend: 'Ext.toolbar.Toolbar'
xtype: 'my-custom-toolbar'
style: 'background-color: #112D41font-family:"Times New Roman",Georgia,Serif'
style设置了背景颜色为#112D41,字体为:Times New Roman",Georgia,Serif
其实你可以通过JS: document.getElementById('id').style.fontSize = '字体大小'Extjs:Ext.getCmp('id').setSize='字体大小'
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)