1
我對Sencha ExtJS和Css都是新手。基本上我有一個3個孩子的面板裏面的主面板。我想使用CSS將相同的背景色設置爲主面板內的三個面板。我創建了一個.css文件並將其鏈接到HTML中。 CSS文件的內容是:ExtJS&Css面板背景的
.x-panel.child-content-style {
background-image : url('TitleBackground.png');
}
我能做到這一點,而不使用CSS通過設置bodyStyle:{"background-image":"url('TitleBackground.png')"}
配置。它完美的工作,但我覺得可能有更好的方法來使用CSS。
當我嘗試使用cls config屬性添加我的css時,沒有任何反應。當設置bodyCls屬性時,它會設置整個應用程序的背景,這不是我想要的。我期待將背景更改爲僅少數幾個面板。我也嘗試在bodyStyle配置中指定css元素名稱來代替內聯,沒有喜悅。
這裏是我的孩子面板的:
{ xtype: 'panel', html: '<img src=\'appIcon.png\' style=\'width:52px;height:52px\'> ', cls: 'child-content-style' },
{ xtype: 'panel', html: '<h2 style=\'font-family:verdana\'>Toolkit v3.0</h2>', bodyStyle:{"background-image":"url('TitleBackground.png')"} },
{ xtype: 'panel', html: ' <img src=\'appIcon.png\' style=\'width:52px;height:52px\'>', bodyStyle:{"background-image":"url('TitleBackground.png')"} }
這甚至可能做或我應該只是cjoke它的損失,並把它內聯?
感謝
像冠軍一樣工作。我曾嘗試閱讀Sencha文檔,但我仍然對cls,bodyCls和bodyStyle配置之間的區別感到困惑。你能否提供對Sencha和Css新手的解釋? – Josh 2014-10-06 12:08:37