html - 如何使面板的高度随位置相对增长

标签 html css

这是我的问题:

PNlmain 是写入游客详细信息的主面板

pnlTouristInfo - 保存一位游客的数据。在系统中,您最多只能为三名游客进行预订 - 高度为 32%。 PnlMai 持有 pnlTouristsInfo

pnlNamepnlCharges 包含游客姓名和费用的信息。它们填满了 pnlTouristInfo 的整个空间。

所以游客只能有一个名字 - 但他可以有很多费用 - 这就是为什么我有 pnlChargesItem

问题是 - 如果游客支付了很多额外费用,如何使 pnlChargepnlName 增长。所以如果它们也增长 pnlTouristInfopnlMain 应该相对增长。另外,例如,如果游客只添加一次费用,我想保存 pnlTouristInfo

的 32% 的 min-height

对不起,这个问题,但我讨厌 css - 而且我是新手

    .pnlMain {
        width:90%;
        min-height:50%;
        height:50%;
        border-top:solid 3px blue;
        margin:auto;

    }

    .pnlTouristInfo {
        position:relative;
        width:99%;
        min-height:32%;
        height:32%;
        border: solid 2px RGB(204,204,204);
    }
    .pnlNames
    {       
        position:relative;
        width: 28.5%;
        height:99%;
        border-right :solid 0.8px RGB(204,204,204);

        float:left;
        text-align:left;

    }


    .pnlCharges {

        position:relative;
        width: 71%;
       height:99%;
        /*border:solid 1px RGB(204,204,204);*/
        float:right;

    }



   .pnlChargesItem {

        position:relative;
        width: 100%;
        height:auto;
        border-bottom:0.8px solid  RGB(204,204,204);
        text-align:left;
        float:left;

    }

    .pnlChargesName {
         position:relative;
        width: 84%;
        height:100%;
        border-right:0.8px solid  RGB(204,204,204);
        text-align:left;
        float:left;
    }
    .pnlChargesPrice {
         position:relative;
        width: 15%;
        height:100%;

        text-align:left;
        float:right;
    }

最佳答案

去掉 height 属性,只保留 min-height(浏览器对 % 属性在垂直位置的理解不同,所以不要用于 padding-top,padding-bottom,(min)-height,margin-top, margin-bottom 等 %)。

关于html - 如何使面板的高度随位置相对增长,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19291721/

相关文章:

javascript - 如何使我的菜单和下拉菜单居中

javascript - 如何从 Google PlusOne 按钮中删除 "Publicly Recommend On Google"弹出窗口?

php - 如何使用 onchange 让多个表行出现/消失

jquery - 如何在同一行制作两个按钮?

javascript - 元素变为可见时的 jQuery

javascript - Handsontable,colWidths : function: how to set a column width fitting content?

c# - 不同网络平台/网络产品之间常见的同音异义词和同义词有哪些?

javascript - 根据 html 中选择的下拉选择选项打开选项卡内容?

javascript - 将代码添加到 Wordpress 站点页面

css - 未应用外部 CSS 属性