Beispiel:CSS-Flexbox-4.html

Aus SELFHTML-Wiki
Wechseln zu: Navigation, Suche
<!DOCTYPE html>
<html lang="de">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <link rel="stylesheet" media="screen" href="./Beispiel:SELFHTML-Beispiel-Grundlayout.css">
  <title>Flexbox 4 - flex-wrap</title>
  <style>

.flex-container {
  display: flex;
  max-width: 45em;
  border: 2px dotted;
}

.flex-item {
  border: 1px solid;
  margin: .5em;
  padding: .5em;
  background: #ffebe6;
}

.no {
  flex-wrap: nowrap;
}

.wrap {
  flex-wrap: wrap;
}

.wrap-reverse {
  flex-wrap: wrap-reverse;
}

p.flex-item {
  font-weight: bold;
  text-align: center;
  width: 12em;
}

.flex-item:nth-of-type(2) {
	background: #fdfcf3;	
}

.flex-item:nth-of-type(3) {
	background: #ebf5d7;
}

.flex-item:nth-of-type(4) {
	background: #e6f2f7;
}

.flex-item:nth-of-type(5) {
	background: hsla(277, 53%, 73%,0.3);
}
</style>
</head>
<body>
  <h1>Flexbox 4 - flex-wrap</h1>
<main>  
<p>Durch die Eigenschaft flex-wrap kann ein Umbruch	flexibler Elemente festgelegt werden.</p>
  <p>nowrap</p>
  <div class="flex-container no">
    <p class="flex-item">1</p>
    <p class="flex-item">2</p>
    <p class="flex-item">3</p>  
    <p class="flex-item">4</p>   
    <p class="flex-item">5</p>             
  </div>
  <p>wrap</p>    
  <div class="flex-container wrap">
    <p class="flex-item">1</p>
    <p class="flex-item">2</p>
    <p class="flex-item">3</p>  
    <p class="flex-item">4</p>   
    <p class="flex-item">5</p>
  </div>  
  <p>wrap-reverse</p>    
  <div class="flex-container wrap-reverse">
    <p class="flex-item">1</p>
    <p class="flex-item">2</p>
    <p class="flex-item">3</p>  
    <p class="flex-item">4</p>   
    <p class="flex-item">5</p>             
</div>
    
  
</main>
</body>
</html>