Div 标签 JQuery UI
我正在开发一个小部件控件。小部件动态加载到小部件容器中。小部件容器包含一个容纳小部件的 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您将 widgetcontainer 的高度设置为 500px。
我想说 widgetarea 确实有 20px 的 margin-bottom,但它看起来比这个更大,因为 widget 区域没有高度。也许设置高度: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%.
Btw, well worth installing http://getfirebug.com/ for debugging these annoying ui issues.