Zitat:
Zitat von esehigs
Was mache ich falsch?
|
Eigentlich viel.
Inline style benutzt man nicht mehr.
Dann kannst du das auch mit Flexbox machen.
HTML-Code:
<html>
<head>
<style>
body{
display:flex;
flex-direction:column;
}
main {
display: flex;
flex-direction: column;
width: 100%;
min-height: 200px;
align-items: center;
}
.rot{
width:300px;
height:100px;
background:red;
}
</style>
</head>
<body>
<main>
<p>Mittiger Text</p>
<div class="rot">
Roter Block
</div>
</main>
</body>
</html>