Reputation: 10185
Does any body know how to achive the output of the XAML below to HTML5 and CSS3:
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="100" />
<RowDefinition Height="33" />
<RowDefinition Height="29" />
<RowDefinition Height="*"/>
<RowDefinition Height="75" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="98" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="98" />
</Grid.ColumnDefinitions>
<Border x:Name="header" Grid.Row="0" Grid.Column="1"/>
<Border x:Name="mainNav" Grid.Row="1" Grid.Column="1"/>
<Border x:Name="secondNav" Grid.Row="2" Grid.Column="1"/>
<Border x:Name="body" Grid.Row="3" Grid.Column="1"/>
<Border x:Name="footer" Grid.Row="4" Grid.Column="1"/>
</Grid>
Thanks
Upvotes: 0
Views: 2306
Reputation: 39458
If I understand you correctly, you just want this code snipped translated to HTML/CSS. A one-to-one translation is shown below.
However, HTML/CSS is a different medium than XAML. E.g. there is no easy way to do Width="*"
in CSS and there is no grid-system built in, so you have to build it with floats (this is for historical reasons, CSS was invented to style text documents, not build layouts). So I would recommend that you look at a more web-friendly solution: a widely-used HTML/CSS scaffolding framework with rows and columns is Bootstrap.
Crude one-to-one translation:
<!DOCTYPE html>
<html>
<head>
<style>
.grid > div > div {
float: left;
outline: 1px solid black;
height: 100%;
min-width: 30px;
}
.header {
height: 100px;
}
.mainNav {
height: 33px;
}
.secondNav {
height: 29px;
}
.body {
height: 30px;
}
.footer {
height: 75px;
}
.grid-column-1 {
width: 98px;
}
.grid-column-2 {
}
.grid-column-3 {
width: 98px;
}
</style>
</head>
<body>
<div class="grid">
<div class="header">
<div class="grid-column-1"></div>
<div class="grid-column-2"></div>
<div class="grid-column-3"></div>
</div>
<div class="mainNav">
<div class="grid-column-1"></div>
<div class="grid-column-2"></div>
<div class="grid-column-3"></div>
</div>
<div class="secondNav">
<div class="grid-column-1"></div>
<div class="grid-column-2"></div>
<div class="grid-column-3"></div>
</div>
<div class="body">
<div class="grid-column-1"></div>
<div class="grid-column-2"></div>
<div class="grid-column-3"></div>
</div>
<div class="footer">
<div class="grid-column-1"></div>
<div class="grid-column-2"></div>
<div class="grid-column-3"></div>
</div>
</div>
</body>
</html>
Upvotes: 2