【发布时间】:2012-03-07 23:54:11
【问题描述】:
我被一些我认为会很简单的事情困住了:)
浮动两个相邻的面板并保持居中。 我得到的最接近的方法是将面板居中但彼此重叠。
像这样:
_
|_|
_
|_|
我正在努力
_ _
|_| |_|
这是我目前的文件
Ext.define("App.view.MyWindow", {
extend:'Ext.panel.Panel',
alias:'widget.mywindow',
requires:[
//this is just a simply panel with html:'abcde"
'App.view.Portal1'
],
items:[{
xtype:'portal1',
height:400,
width:400,
style:{
margin: '0 auto',
}
},{
xtype:'portal1',
height:400,
width:400,
style:{
margin: '0 auto',
}
}]
});
有什么想法吗?欢迎大家:) ...提前感谢
更新: 我最接近的“解决方案”如下:(但是它需要设置宽度)
Ext.define("App.view.MyWindow", {
extend:'Ext.panel.Panel',
alias:'widget.mywindow',
requires:[
//this is just a simply panel with html:'abcde" with width & height 400
'App.view.Portal1'
],
layout:'fit',
items:[{
layout:{
type:'vbox',
align:'center'
},
items:[{
layout:{
type:'hbox',
},
//Set width :(
width:800,
items:[{
xtype:'portal1',
},{
xtype:'portal1',
}]
}]
}]
});
解决方案
感谢评论的人。这是一个有效的解决方案。不要在包装面板上使用layout:fit
Ext.define("App.view.MyWindow", {
extend:'Ext.panel.Panel',
alias:'widget.mywindow',
requires:[
//this is just a simply panel with html:'abcde" with width & height 400
'App.view.Portal1'
],
style:{
textAlign:'center'
},
items:[{
xtype:'portal1',
style:{
display:'inline-block'
}
},{
xtype:'portal1',
style:{
display:'inline-block'
}
}]
});
【问题讨论】:
标签: css extjs css-float center