HTML表格中行的动态高度

时间:2012-01-05 22:37:02

标签: html razor

我的页面上有一张桌子。根据选择,我可以在表格中有4行或5行。 无论我有4行还是5行,我都希望我的顶行高度准确无误。当我在表格中有4行时,它会增加我的顶行的大小。任何想法如何每次都使顶行具有相同的高度?

这是我的表:

<table style="vertical-align:top; border-width:1px; border-style:solid; width:565px; height:155px; color:Black; font-size:8pt; left:19%; top:0px; position:absolute; border-color:Blue;">    
    <tr style="height:30px;">                        
        <td align="left" style="width:190px; font-size:9pt; font-weight:bold; height:30px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;@(Model.PlanSummary.Header)</td>
        <td style="background-color:Red; width:130px; color:White; text-align:center; height:30px;">@(Model.PlanSummary.PlanTypes_1)</td>
        <td align="center" style="background-color:Red; width:130px; color:White; height:30px; text-align:center; height:30px;">@(Model.PlanSummary.PlanTypes_2)</td>
        <td align="center" style="background-color:Red; width:130px; color:White; height:30px; height:30px;">@(Model.PlanSummary.PlanTypes_3)</td>
    </tr>
    @{
        if(planName == "Business User")
        {
            <tr style="font-size:7pt;">
                <td align="left" style="width:190px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;@(Model.PlanSummary.PlanUsersHeader) </td>
                <td align="center" style="width:120px;"> @(Model.PlanSummary.PlanUsersDetail1) </td>
                <td align="center" style="width:120px;"> @(Model.PlanSummary.PlanUsersDetail2) </td>               
                <td align="center" style="width:120px;"> @(Model.PlanSummary.PlanUsersDetail3) </td>
            </tr>   
        }        
     }
    <tr style="font-size:7pt;">
        <td align="left" style="width:190px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;@(Model.PlanSummary.PlanPriceHeader)</td>
        <td align="center"> @(Model.PlanSummary.PlanPriceDetail1) </td>
        @{
            if(planName == "Business User")
            {
                <td align="center" style="width:120px; font-size: 9pt;"> 
                    @Html.DropDownList("RPUserPricingList", (IEnumerable<SelectListItem>)Model.PlanSummary.UserPricingList, new { style = "font-family: Verdana; font-size: 6pt; text-align:center; width:100px;" })                    
                </td>
                <td align="center" style="width:120px; font-size: 9pt;"> 
                    @Html.DropDownList("RPCompanyPricingList", (IEnumerable<SelectListItem>)Model.PlanSummary.ComanyPricingList, new { style = "font-family: Verdana; font-size: 6pt; text-align:center; width:90px;" })                    
                </td>
            }
            else
            {
                <td align="center"> @(Model.PlanSummary.PlanPriceDetail2) </td>      
                <td align="center"> @(Model.PlanSummary.PlanPriceDetail3) </td>
            }
         }                
    </tr>   
    <tr style="font-size:7pt;">
        <td align="left" style="width:190px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;@(Model.PlanSummary.PlanUnitCountHeader)</td>
        <td align="center"> @(Model.PlanSummary.PlanUnitCountDetail1) </td>
        <td align="center"> @(Model.PlanSummary.PlanUnitCountDetail2) </td>
        <td align="center"> @(Model.PlanSummary.PlanUnitCountDetail3) </td>
    </tr>       
    <tr>
        <td></td>
        @{
            if(planName == "Personal")
            {
                  <td align="center"><button style="background-image:url('Content/Images/ShortRedButton.png');color:White;width:86px;height:24px;font-size:6pt;">@(Model.PlanSummary.Btn1)</button></td>
                  <td align="center"><button style="background-image:url('Content/Images/ShortRedButton.png');color:White;width:86px;height:24px;font-size:6pt;">@(Model.PlanSummary.Btn2)</button></td>
                  <td align="center"><button style="background-image:url('Content/Images/ShortRedButton.png');color:White;width:86px;height:24px;font-size:6pt;">@(Model.PlanSummary.Btn3)</button></td>
            }
            else
            {
                <td align="center"><button style="background-image:url('Content/Images/ShortRedButton.png');color:White;width:86px;height:24px;font-size:6pt;">@(Model.PlanSummary.Btn1)</button></td>
                <td align="center"><button style="background-image:url('Content/Images/ShortRedButton.png');color:White;width:86px;height:24px;font-size:6pt;">@(Model.PlanSummary.Btn2)</button></td>
                <td align="center">
                    <button style="background-image:url('Content/Images/LongRedButton.png');color:White;width:96px;height:26px;font-size:6pt;">@(Model.PlanSummary.Btn3)</button>                            
                    <br />
                    <button style="background-image:url('Content/Images/LongRedButton.png');color:White;width:96px;height:26px;font-size:6pt;">@(Model.PlanSummary.Btn4)</button> 
                </td>
            }               
         }        
    </tr>   
</table>

1 个答案:

答案 0 :(得分:0)

我从表中删除了高度元素,它对我有用。 感谢!!!!