如何在 Sencha Touch 2 中正确设置右手边距?
我正在开发这个应用程序,但我似乎无法让我的边距保持在屏幕右侧的正确设置。注意:顶部、底部和左侧工作正常。
这是一个屏幕截图
(出于某种原因,SO 抱怨格式)
我有以下 CSS 样式
#rpc-view-home-indexview{
margin: 5px;
}
,这是我的 JS 视图
Ext.define('rpc.view.home.indexView', {
extend: 'Ext.Panel',
id: 'rpc-view-home-indexview', // This is where I'm setting the element for the margin
alias: 'widget.home-indexView',
config: {
scroll: 'vertical',
items: [{
xtype: 'container',
items: [{
html: '<div class="rounded-div"><h1>RockPointe Church</h1><i>One church meeting in multiple locations.</i></div>'
}]
}, {
// ...
}]
}
});
编辑
如果有人关心的话,这里是相关的渲染 html
<div class="x-body" id="ext-element-44">
<div class="x-inner x-layout-card" id="ext-element-4">
<div class="x-container x-panel x-layout-card-item" id="rpc-view-home-indexview" style="">
<div class="x-body x-scroll-view" id="ext-element-24">
<div class="x-scroll-bar-grid-wrapper" id="ext-element-23">
<div class="x-scroll-bar-grid">
<div>
<div></div>
<div>
<div class="x-scroll-bar x-scroll-bar-y" id="ext-element-22">
<div class="x-scroll-indicator-csstransform x-scroll-indicator x-scroll-indicator-y"
style="opacity: 0; -webkit-transform: translate3d(0px, 0px, 0px); "
id="ext-component-2">
<div id="ext-element-26"></div>
<div id="ext-element-28"
style="-webkit-transform: translate3d(0px, 0px, 0px) scaleY(570); top: 3px; "></div>
<div id="ext-element-27"
style="-webkit-transform: translate3d(0px, 573px, 0px); "></div>
</div>
</div>
</div>
</div>
<div>
<div>
<div id="ext-element-18" class="x-scroll-bar x-scroll-bar-x">
<div id="ext-component-1"
class="x-scroll-indicator-csstransform x-scroll-indicator x-scroll-indicator-x"
style="opacity: 0; -webkit-transform: translate3d(0px, 0px, 0px); ">
<div id="ext-element-19"></div>
<div id="ext-element-20"></div>
<div id="ext-element-21"></div>
</div>
</div>
</div>
<div></div>
</div>
</div>
</div>
<div id="ext-element-25" class="x-scroll-container">
<div class="x-inner x-panel-inner x-scroll-scroller" id="ext-element-6">
<div class="x-container" id="ext-container-1">
<div class="x-inner" id="ext-element-7">
<div class="x-container" id="ext-container-2">
<div class="x-inner" id="ext-element-8">
<div class="x-innerhtml " id="ext-element-9">
<div class="rounded-div"><h1>RockPointe Church</h1><i>One church meeting in
multiple locations.</i></div>
</div>
</div>
</div>
</div>
</div>
<div class="x-container" id="ext-container-3">
<div class="x-inner x-layout-hbox" id="ext-element-10"
style="-webkit-box-align: stretch; -webkit-box-pack: center; ">
<div id="ext-button-1" class="x-button x-button-rpc x-button-plain x-layout-box-item"
style="margin-top: 5px; -webkit-box-flex: 1; "><span style="display: none; "
id="ext-element-11"
class="x-badge"></span><span
class="x-button-icon" style="display: none; " id="ext-element-13"></span><span
style="" id="ext-element-12" class="x-button-label">Videos</span></div>
<div class="x-container x-button-rpc-spacer" id="ext-container-4"
style="margin-top: 5px;">
<div class="x-inner" id="ext-element-14"></div>
</div>
<div class="x-button x-button-rpc x-button-plain x-layout-box-item" id="ext-button-2"
style="margin-top: 5px; -webkit-box-flex: 1; "><span style="display: none; "
class="x-badge"></span><span
class="x-button-icon" style="display: none; "></span><span style=""
class="x-button-label"
id="ext-element-15">Events</span>
</div>
<div class="x-container x-button-rpc-spacer" id="ext-container-5"
style="margin-top: 5px;">
<div class="x-inner" id="ext-element-16"></div>
</div>
<div class="x-button x-button-rpc x-button-plain x-layout-box-item" id="ext-button-3"
style="margin-top: 5px; -webkit-box-flex: 1; "><span style="display: none; "
class="x-badge"></span><span
class="x-button-icon" style="display: none; "></span><span style=""
class="x-button-label"
id="ext-element-17">Sites</span>
</div>
</div>
</div>
<div class="x-size-change-detector x-size-change-detector-expand">
<div></div>
</div>
<div class="x-size-change-detector x-size-change-detector-shrink">
<div></div>
</div>
</div>
<div class="x-size-change-detector x-size-change-detector-expand">
<div></div>
</div>
<div class="x-size-change-detector x-size-change-detector-shrink">
<div></div>
</div>
</div>
</div>
</div>
<div class="x-container x-layout-card-item" id="ext-container-6" style="display: none !important; ">
<div class="x-inner" id="ext-element-32"></div>
</div>
<div class="x-container x-layout-card-item" id="ext-container-7" style="display: none !important; ">
<div class="x-inner" id="ext-element-35"></div>
</div>
<div class="x-container x-layout-card-item" id="ext-container-8" style="display: none !important; ">
<div class="x-inner" id="ext-element-38"></div>
</div>
<div class="x-container x-layout-card-item" id="ext-container-9" style="display: none !important; ">
<div class="x-inner" id="ext-element-41"></div>
</div>
</div>
</div>
I'm working on this app, and I can't seem to get my margin to stay set properly on the right side of the screen. NOTE: the top, bottom, and left sides are working just fine.
Here's a screenshot
(for some reason SO was complaining about the format)
I've got the following CSS Styling
#rpc-view-home-indexview{
margin: 5px;
}
And this is my JS View
Ext.define('rpc.view.home.indexView', {
extend: 'Ext.Panel',
id: 'rpc-view-home-indexview', // This is where I'm setting the element for the margin
alias: 'widget.home-indexView',
config: {
scroll: 'vertical',
items: [{
xtype: 'container',
items: [{
html: '<div class="rounded-div"><h1>RockPointe Church</h1><i>One church meeting in multiple locations.</i></div>'
}]
}, {
// ...
}]
}
});
Edit
and if anybody cares, here's the relevant rendered html
<div class="x-body" id="ext-element-44">
<div class="x-inner x-layout-card" id="ext-element-4">
<div class="x-container x-panel x-layout-card-item" id="rpc-view-home-indexview" style="">
<div class="x-body x-scroll-view" id="ext-element-24">
<div class="x-scroll-bar-grid-wrapper" id="ext-element-23">
<div class="x-scroll-bar-grid">
<div>
<div></div>
<div>
<div class="x-scroll-bar x-scroll-bar-y" id="ext-element-22">
<div class="x-scroll-indicator-csstransform x-scroll-indicator x-scroll-indicator-y"
style="opacity: 0; -webkit-transform: translate3d(0px, 0px, 0px); "
id="ext-component-2">
<div id="ext-element-26"></div>
<div id="ext-element-28"
style="-webkit-transform: translate3d(0px, 0px, 0px) scaleY(570); top: 3px; "></div>
<div id="ext-element-27"
style="-webkit-transform: translate3d(0px, 573px, 0px); "></div>
</div>
</div>
</div>
</div>
<div>
<div>
<div id="ext-element-18" class="x-scroll-bar x-scroll-bar-x">
<div id="ext-component-1"
class="x-scroll-indicator-csstransform x-scroll-indicator x-scroll-indicator-x"
style="opacity: 0; -webkit-transform: translate3d(0px, 0px, 0px); ">
<div id="ext-element-19"></div>
<div id="ext-element-20"></div>
<div id="ext-element-21"></div>
</div>
</div>
</div>
<div></div>
</div>
</div>
</div>
<div id="ext-element-25" class="x-scroll-container">
<div class="x-inner x-panel-inner x-scroll-scroller" id="ext-element-6">
<div class="x-container" id="ext-container-1">
<div class="x-inner" id="ext-element-7">
<div class="x-container" id="ext-container-2">
<div class="x-inner" id="ext-element-8">
<div class="x-innerhtml " id="ext-element-9">
<div class="rounded-div"><h1>RockPointe Church</h1><i>One church meeting in
multiple locations.</i></div>
</div>
</div>
</div>
</div>
</div>
<div class="x-container" id="ext-container-3">
<div class="x-inner x-layout-hbox" id="ext-element-10"
style="-webkit-box-align: stretch; -webkit-box-pack: center; ">
<div id="ext-button-1" class="x-button x-button-rpc x-button-plain x-layout-box-item"
style="margin-top: 5px; -webkit-box-flex: 1; "><span style="display: none; "
id="ext-element-11"
class="x-badge"></span><span
class="x-button-icon" style="display: none; " id="ext-element-13"></span><span
style="" id="ext-element-12" class="x-button-label">Videos</span></div>
<div class="x-container x-button-rpc-spacer" id="ext-container-4"
style="margin-top: 5px;">
<div class="x-inner" id="ext-element-14"></div>
</div>
<div class="x-button x-button-rpc x-button-plain x-layout-box-item" id="ext-button-2"
style="margin-top: 5px; -webkit-box-flex: 1; "><span style="display: none; "
class="x-badge"></span><span
class="x-button-icon" style="display: none; "></span><span style=""
class="x-button-label"
id="ext-element-15">Events</span>
</div>
<div class="x-container x-button-rpc-spacer" id="ext-container-5"
style="margin-top: 5px;">
<div class="x-inner" id="ext-element-16"></div>
</div>
<div class="x-button x-button-rpc x-button-plain x-layout-box-item" id="ext-button-3"
style="margin-top: 5px; -webkit-box-flex: 1; "><span style="display: none; "
class="x-badge"></span><span
class="x-button-icon" style="display: none; "></span><span style=""
class="x-button-label"
id="ext-element-17">Sites</span>
</div>
</div>
</div>
<div class="x-size-change-detector x-size-change-detector-expand">
<div></div>
</div>
<div class="x-size-change-detector x-size-change-detector-shrink">
<div></div>
</div>
</div>
<div class="x-size-change-detector x-size-change-detector-expand">
<div></div>
</div>
<div class="x-size-change-detector x-size-change-detector-shrink">
<div></div>
</div>
</div>
</div>
</div>
<div class="x-container x-layout-card-item" id="ext-container-6" style="display: none !important; ">
<div class="x-inner" id="ext-element-32"></div>
</div>
<div class="x-container x-layout-card-item" id="ext-container-7" style="display: none !important; ">
<div class="x-inner" id="ext-element-35"></div>
</div>
<div class="x-container x-layout-card-item" id="ext-container-8" style="display: none !important; ">
<div class="x-inner" id="ext-element-38"></div>
</div>
<div class="x-container x-layout-card-item" id="ext-container-9" style="display: none !important; ">
<div class="x-inner" id="ext-element-41"></div>
</div>
</div>
</div>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我敢打赌问题是 width:100% 你在那里。这意味着它将使用容器 div 大小的 100%,即与屏幕一样宽。添加 5 px 边距以及您拥有的任何填充或边框,您最终会在屏幕之外。
有道理吗?
I bet the problem is that width:100% you have there. That means that it's going to use 100% of the size of the container div, which is as wide as the screen. add the 5 px margin plus whatever padding or borders you have and you end up outside of the screen.
Makes sense?
哇,出于某种原因,当我看着简单的解决方案时,我的大脑就停止运转了。 :(
Wow, for some reason my brain simply shuts off when I'm looking at the simple solutions. :(