Gewusst wie: Dreispaltiges Layout
Erfahren Sie, wie Sie mit CSS ein 3-Spalten-Layoutraster erstellen.
So erstellen Sie ein dreispaltiges Layout
Schritt 1) HTML hinzufügen:
Beispiel
<div class="row">
<div class="column"></div>
<div
class="column"></div>
<div
class="column"></div>
</div>
Schritt 2) CSS hinzufügen:
In diesem Beispiel erstellen wir drei gleiche Spalten:
Beispiel
.column {
float: left;
width: 33.33%;
}
/* Clear floats after the
columns */
.row:after {
content: "";
display: table;
clear: both;
}
In diesem Beispiel erstellen wir drei ungleiche Spalten:
Beispiel
.column {
float: left;
}
.left, .right {
width: 25%;
}
.middle {
width: 50%;
}
In diesem Beispiel erstellen wir ein responsives dreispaltiges Layout:
Beispiel
/* Responsive layout - when the screen is less than 600px wide, make the
three
columns stack on top of each other instead of next to each other */
@media
screen and (max-width: 600px) {
.column {
width: 100%;
}
}
Tipp: Gehen Sie zu unserem CSS-Website-Layout -Tutorial, um mehr über Website-Layouts zu erfahren.
Tipp: Gehen Sie zu unserem CSS Responsive Webdesign Tutorial, um mehr über responsives Webdesign und Grids zu erfahren.