Hallo
ZitatGibt es auch eine Möglichkeit, dass für alle Browser zu machen?
Für die wichtigen - ja. Es gibt verschiedene Lösungen: display: table oder display: inline-block oder float oder display: flex
Wobei ich display: flex (das Flexbox-Modell) bevorzuge.
Dafür habe ich auch mal ein Beispiel erstellt:
HTML
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="utf-8">
<title>Flexbox-Layout 02</title>
<meta name="description" content="HTML5, CSS3">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!--[if lt IE 9]>
<script src="http://html5shiv-printshiv.googlecode.com/svn/trunk/html5shiv-printshiv.js"></script>
<![endif]-->
<style>
@media all {
header, nav, main, aside, footer, section, article, figure, figcaption, audio, video {
display: block;
}
* {
box-sizing: border-box;
}
html {
font-family: sans-serif;
font-size: 120%;
line-height: 1.3;
}
body {
margin: 0;
display: flex;
flex-wrap: wrap;
}
.obenlinks,
.obenrechts,
nav,
aside {
width: 25%;
}
header,
article {
width: 50%;
}
footer {
width: 100%;
}
.obenlinks,
header,
.obenrechts {
height: 120px;
}
nav,
article,
aside {
height: 300px;
}
footer {
height: 100px;
}
.obenlinks {
/*background: rot*/
background: #ED1C24;
}
header {
/*background: hellbraun*/
background: #b07e4a;
}
.obenrechts {
/*background: pink*/
background: #FFAEC9;
}
nav {
/*background: grün*/
background: #94c11f;
}
article {
/*background: weiß*/
background: white;
}
aside {
/*background: blau*/
background: #38aae1;
}
footer {
/*background: dunkelbraun*/
background: #683c10;
}
}
</style>
</head>
<body>
<div class="obenlinks">
<p>div.obenlinks rot</p>
</div>
<header>
<p>header hellbraun</p>
</header>
<div class="obenrechts">
<p>div.obenrechts pink</p>
</div>
<nav>
<p>nav grün</p>
</nav>
<article>
<p>article weiß</p>
<p>Die Seite wurde mit dem flexbox-Layout ( display: flex; ) erstellt.</p>
</article>
<aside>
<p>aside blau</p>
</aside>
<footer>
<p>footer dunkelbraun</p>
</footer>
</body>
</html>
Alles anzeigen
Gruss
MrMurphy