Div 标签 JQuery UI

发布于 2024-12-08 02:45:48 字数 1333 浏览 0 评论 0原文

我正在开发一个小部件控件。小部件动态加载到小部件容器中。小部件容器包含一个容纳小部件的 div,这称为小部件区域。小部件容器可使用 JQuery UI 进行拖动和调整大小。

我遇到的问题是小部件区域的下边距似乎不起作用,或者也许我误解了边距的工作原理。左上角和右边距工作正常,我将它们设置为 20px,因此小部件区域距离小部件容器的左上角和右侧为 20px。底部边距也是 20 像素,但小部件区域底部与小部件容器底部之间的距离远大于 20 像素。我在 Firefox 中尝试过,也出现了同样的问题。

当我调整小部件容器的大小时,小部件区域的左侧也会由于边距而调整大小,但是小部件的底部根本不会调整大小,因为底部边距似乎不起作用。

这是我的小部件容器和 css。

<asp:Panel ID="Panel1" CssClass="widgetcontainer" runat="server" Height="500px" BorderStyle="Solid" BorderWidth="1px" Width="485px" BackColor="White">
    <asp:Panel ID="Panel2" CssClass="widgetcontainerheader" runat="server">
        <asp:Label ID="Label2" runat="server" Text="Gadget header"></asp:Label>
    </asp:Panel>

    <asp:Panel ID="WidgetBodyPanel" CssClass="widgetarea" runat="Server"    BorderStyle="Solid">
        <p>
            some text
        </p>
    </asp:Panel>

</asp:Panel>

div.widgetcontainerheader
{
    background-color:#CCFF99;

    border-bottom-style:solid;
    border-bottom-width:thin;
    border-bottom-color:#D2D2D2;

    position: relative;
    width:100%;
    height:20px;
}

.widgetarea
{
    position:relative;

    margin-left:20px;
    margin-top:20px;
    margin-right:20px;
    margin-bottom:20px;

}

有人可以告诉我为什么底部边距不起作用吗?

谢谢

I am working on a widget control. The widget is loaded dynamically into a widget container. The widget container contains a div which holds the widget, this is known as the widget area. The widget container is made to be draggable and resizable using JQuery UI.

The problem I am having is that the bottom-margin of the widget area does not seem to work or perhaps I am misuderstanding how margins work. The left top and right margins work fine, I have them set at 20px and so the widget area is 20px from the left top and right of the widget container. The bottom margin is also 20px but the distance between the bottom of the widget area is much more than 20px from the bottom of the widget container. I have tried it in firefox and the same issue occurs.

When I resize the widget container the widget area's left also resizes because of the margins however the bottom of the widget are doesn't resize at all because bottom-margin doesn't seem to be working.

here is my widget container and css.

<asp:Panel ID="Panel1" CssClass="widgetcontainer" runat="server" Height="500px" BorderStyle="Solid" BorderWidth="1px" Width="485px" BackColor="White">
    <asp:Panel ID="Panel2" CssClass="widgetcontainerheader" runat="server">
        <asp:Label ID="Label2" runat="server" Text="Gadget header"></asp:Label>
    </asp:Panel>

    <asp:Panel ID="WidgetBodyPanel" CssClass="widgetarea" runat="Server"    BorderStyle="Solid">
        <p>
            some text
        </p>
    </asp:Panel>

</asp:Panel>

div.widgetcontainerheader
{
    background-color:#CCFF99;

    border-bottom-style:solid;
    border-bottom-width:thin;
    border-bottom-color:#D2D2D2;

    position: relative;
    width:100%;
    height:20px;
}

.widgetarea
{
    position:relative;

    margin-left:20px;
    margin-top:20px;
    margin-right:20px;
    margin-bottom:20px;

}

Could someone please advise why the bottom-margin does not work?

Thank you

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

傾旎 2024-12-15 02:45:48

您将 widgetcontainer 的高度设置为 500px。

我想说 widgetarea 确实有 20px 的 margin-bottom,但它看起来比这个更大,因为 widget 区域没有高度。也许设置高度:100%。

.widgetarea
{
  margin: 20px;
  height: 100%;
}

顺便说一句,非常值得安装 http://getfirebug.com/ 来调试这些烦人的用户界面问题。

You have the height of the widgetcontainer set to 500px.

I would say that widgetarea does have a margin-bottom of 20px but that it appears larger than that because the widget area has no height. Perhaps set height: 100%.

.widgetarea
{
  margin: 20px;
  height: 100%;
}

Btw, well worth installing http://getfirebug.com/ for debugging these annoying ui issues.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文