0

我正在开发这个应用程序,我似乎无法让我的边距保持在屏幕右侧正确设置。注意:顶部、底部和左侧工作正常。

这是一个截图
(出于某种原因,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>
4

2 回答 2

0

我敢打赌,问题是宽度:100% 你在那里。这意味着它将使用 100% 的容器 div 大小,它与屏幕一样宽。添加 5 px 边距加上您拥有的任何填充或边框,您最终会出现在屏幕之外。

说得通?

于 2011-10-21T04:04:52.377 回答
0

哇,由于某种原因,当我查看简单的解决方案时,我的大脑只是关闭了。:(

#rpc-view-home-indexview{
    padding: 5px;
}
于 2011-10-22T17:13:34.777 回答