asp.net - 当窗口变小时,如何防止面板被强制置于另外两个面板下方?

标签 asp.net css

我有三个这样的面板:

 ___    _________    ___
|   |  |         |  |   |
|   |  |         |  |   |
|   |  |         |  |   |
|   |  |         |  |   |
|___|  |_________|  |___|

但是如果我稍微缩短窗口,中间面板会低于两个侧面板:

 ___                ___
|   |              |   |
|   |              |   |
|   |              |   |
|   |              |   |
|___|              |___|
 _________ 
|         |
|         |
|         |
|         |
|_________|

这是我的代码

<style>
   .SidePanel {
       background-color:#9999CC;
       width:100px;
       height:597px;
   }
</style>

<div style="text-align:center;">
         <div style="float:left">
             <asp:Panel ID="Panel4" runat="server" CssClass="SidePanel" BorderColor="DarkBlue" BorderWidth="2px"/>
         </div>

         <div style="float:right">
                    <asp:Panel ID="Panel5" runat="server" CssClass="SidePanel" BorderColor="DarkBlue" BorderWidth="2px"/> 
         </div>

         <div style="display:inline;">
             <asp:Panel ID="Panel0" runat="server" BackColor="#9999CC" BorderColor="DarkBlue" BorderWidth="2px" Width="900">
                 ...content...
             </asp:Panel> 

            </div>
</div>

我如何阻止它这样做?

编辑:这是我根据回复所做的更改。

<style>
  .SidePanel {
      background-color:#9999CC;
      height:597px;
  }
</style>

<div style="text-align:center; min-width:1024px; width:100%;">
            <div style="float:left; width:10%">
                <asp:Panel ID="Panel4" runat="server" CssClass="SidePanel" BorderColor="DarkBlue" BorderWidth="2px"/>
            </div>

            <div style="float:right; width:10%">
                <asp:Panel ID="Panel5" runat="server" CssClass="SidePanel" BorderColor="DarkBlue" BorderWidth="2px"/> 
            </div>

            <div style="width:70%">
                <asp:Panel ID="Panel0" runat="server" BackColor="#9999CC" BorderColor="DarkBlue" BorderWidth="2px" style="width:100%;">

最佳答案

这是我所拥有的:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Three Little Panels, All in a Row</title>
<style>
#container
{
min-width:800px;
overflow:auto;
}
.littlePanels
{
float:left;
width:100px;
background-color:#999900;
}
.bigOlePanel
{
float:left;
width:600px;
background-color:#CC9966
}
</style>
</head>

<body>
<div id="container">
<div class="littlePanels">&nbsp;</div>
<div class="bigOlePanel">&nbsp;</div>
<div class="littlePanels">&nbsp;</div>
</div>
</body>
</html>

希望这能奏效!

关于asp.net - 当窗口变小时,如何防止面板被强制置于另外两个面板下方?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2028493/

相关文章:

javascript - 为附加了 Javascript 的元素 Bootstrap 即时响应高度

html - 响应式布局 - 确定缩放

c# - .NET 公共(public)静态变量的 "lifespan"?

asp.net - 从 ASP.NET 3.5 应用程序在 IFRAME 内运行 GWT 应用程序(包括小程序)?

asp.net - 将 System.windows.Forms 引用添加到 asp.net 网站

javascript - jQuery 无法删除父 div

css - 如何在不指定内部 div 高度的情况下在内部 div 周围放置一致的 5px 边距?

javascript - 子元素的 className 会影响父元素

c# - ASP.NET MVC 中身份验证的 OutputCache 困境

c# - 三层架构 C# 中的循环引用问题