简体   繁体   中英

WPF-like layout in HTML5 /CSS3

How can I achieve the equivalent of:

<Grid>
 <Grid.RowDefinitions>
  <RowDefinition Height="300">
  <RowDefinition Height="*">
  <RowDefinition Height="100">

whe the row with height * fills the remaining screen space after the top and bottom rows have taken their 400px?

Thanks

You can achieve this by using div(s)

<div class="upperSection">

</div>

<div class="content">

</div>


<div class="lowerSection">

</div>

and Css:

.upperSection
{
    position:absolute;
    top:0;
    left:0;
    height:300px;
    width:100%;
}

.content
{
  position:absolute;
  top:300px;
  left:0;
  height:100%;
  width:100%;
}

.lowerSection
{
  position:absolute;
 bottom:0;
 left:0;
 height:100px;
 width:100%;

}

This should fix the problem:

.upperSection
{    
    top:0;
    left:0;
    height:300px;
    width:100%;

}

.content
{  
  position:absolute;   
  left:0;
  top:300px;
  bottom:100px;  
  width:100%;



}

.lowerSection
{
 position:absolute;
 bottom:0;
 left:0;
 height:100px;
 width:100%;


}

Cheers.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM