Zum Inhalt springen

CSS-Eigenschaft flex-flow

Die Eigenschaft flex-flow gilt als Kurzschreibweise für die Eigenschaften flex-wrap und flex-direction.

Diese Eigenschaft ist eine der CSS3-Eigenschaften. Sie ist Teil des Flexible Box Layout-Moduls.

Wenn es keine flexiblen Elemente gibt, hat die Eigenschaft flex-flow keine Wirkung.

Moderne Browser unterstützen die Eigenschaft flex-flow nativ ohne Vendor-Präfixe.

Anfangswertrow nowrap
Gilt fürFlex-Container
VererbtNein.
AnimierbarNein.
VersionCSS3
DOM-Syntaxobject.style.flexFlow = "column nowrap";

Syntax

Syntax der CSS-Eigenschaft flex-flow

css
flex-flow: <flex-direction> || <flex-wrap>;
/* or */ initial | inherit;

Wenn wir flex-flow: row wrap; setzen, bedeutet das, dass der erste Wert flex-direction definiert und der zweite Wert die Eigenschaft flex-wrap definiert.

Beispiel der CSS-Eigenschaft flex-flow

css
flex-flow: row wrap;

Der folgende Code ist derselbe wie der obige Code.

Beispiel der Eigenschaften flex-direction und flex-wrap

css
flex-direction: row;
flex-wrap: wrap;

Beispiel der Eigenschaft flex-flow mit den Werten "row" und "wrap":

html
<!DOCTYPE html>
<html>
  <head>
    <title>Title of the document</title>
    <style>
      .example {
        width: 200px;
        height: 200px;
        border: 1px solid #c3c3c3;
        display: flex;
        flex-flow: row wrap;
      }
      .example div {
        width: 50px;
        height: 50px;
      }
    </style>
  </head>
  <body>
    <h2>Flex-flow property example</h2>
    <div class="example">
      <div style="background-color: #8ebf42;">A</div>
      <div style="background-color: #1c87c9;">B</div>
      <div style="background-color: #cccccc;">C</div>
      <div style="background-color: #666666;">D</div>
      <div style="background-color: #4c4a4a;">E</div>
      <div style="background-color: #c6c4c4;">F</div>
    </div>
  </body>
</html>

Beispiel der Eigenschaft flex-flow mit den Werten "wrap-reverse" und "column":

html
<!DOCTYPE html>
<html>
  <head>
    <title>Title of the document</title>
    <style>
      .example {
        width: 200px;
        height: 200px;
        border: 1px solid #c3c3c3;
        display: flex;
        flex-flow: column wrap-reverse;
      }
      .example div {
        width: 50px;
        height: 50px;
      }
    </style>
  </head>
  <body>
    <h2>Flex-flow property example</h2>
    <div class="example">
      <div style="background-color: #8ebf42;">A</div>
      <div style="background-color: #1c87c9;">B</div>
      <div style="background-color: #cccccc;">C</div>
      <div style="background-color: #666666;">D</div>
      <div style="background-color: #4c4a4a;">E</div>
      <div style="background-color: #c6c4c4;">F</div>
    </div>
  </body>
</html>

Beispiel der Eigenschaft flex-flow mit den Werten "row" und "nowrap":

html
<!DOCTYPE html>
<html>
  <head>
    <title>Title of the document</title>
    <style>
      .example {
        width: 200px;
        height: 200px;
        border: 1px solid #c3c3c3;
        display: flex;
        flex-flow: row nowrap;
      }
      .example div {
        width: 50px;
        height: 50px;
      }
    </style>
  </head>
  <body>
    <h2>Flex-flow property example</h2>
    <div class="example">
      <div style="background-color: #8ebf42;">A</div>
      <div style="background-color: #1c87c9;">B</div>
      <div style="background-color: #cccccc;">C</div>
      <div style="background-color: #666666;">D</div>
      <div style="background-color: #4c4a4a;">E</div>
      <div style="background-color: #c6c4c4;">F</div>
    </div>
  </body>
</html>

Ergebnis

CSS flex-flow Property

Beispiel der Eigenschaft flex-flow mit den Werten "row-reverse" und "nowrap":

html
<!DOCTYPE html>
<html>
  <head>
    <title>Title of the document</title>
    <style>
      .example {
        width: 200px;
        height: 200px;
        border: 1px solid #c3c3c3;
        display: flex;
        flex-flow: row-reverse nowrap;
      }
      .example div {
        width: 50px;
        height: 50px;
      }
    </style>
  </head>
  <body>
    <h2>Flex-flow property example</h2>
    <div class="example">
      <div style="background-color: #8ebf42;">A</div>
      <div style="background-color: #1c87c9;">B</div>
      <div style="background-color: #cccccc;">C</div>
      <div style="background-color: #666666;">D</div>
      <div style="background-color: #4c4a4a;">E</div>
      <div style="background-color: #c6c4c4;">F</div>
    </div>
  </body>
</html>

Beispiel der Eigenschaft flex-flow mit den Werten "column" und "nowrap":

html
<!DOCTYPE html>
<html>
  <head>
    <title>Title of the document</title>
    <style>
      .example {
        width: 200px;
        height: 200px;
        border: 1px solid #c3c3c3;
        display: flex;
        flex-flow: column nowrap;
      }
      .example div {
        width: 50px;
        height: 50px;
      }
    </style>
  </head>
  <body>
    <h2>Flex-flow property example</h2>
    <div class="example">
      <div style="background-color: #8ebf42;">A</div>
      <div style="background-color: #1c87c9;">B</div>
      <div style="background-color: #cccccc;">C</div>
      <div style="background-color: #666666;">D</div>
      <div style="background-color: #4c4a4a;">E</div>
      <div style="background-color: #c6c4c4;">F</div>
    </div>
  </body>
</html>

Beispiel der Eigenschaft flex-flow mit den Werten "column-reverse" und "nowrap":

html
<!DOCTYPE html>
<html>
  <head>
    <title>Title of the document</title>
    <style>
      .example {
        width: 200px;
        height: 200px;
        border: 1px solid #c3c3c3;
        display: flex;
        flex-flow: column-reverse nowrap;
      }
      .example div {
        width: 50px;
        height: 50px;
      }
    </style>
  </head>
  <body>
    <h2>Flex-flow property example</h2>
    <div class="example">
      <div style="background-color: #8ebf42;">A</div>
      <div style="background-color: #1c87c9;">B</div>
      <div style="background-color: #cccccc;">C</div>
      <div style="background-color: #666666;">D</div>
      <div style="background-color: #4c4a4a;">E</div>
      <div style="background-color: #c6c4c4;">F</div>
    </div>
  </body>
</html>

Werte

WertBeschreibungPlay it
flex-directionDefiniert die Richtung flexibler Elemente. Mögliche Werte sind: row row-reverse column column-reverse initial inheritPlay it »
flex-wrapDefiniert, ob flexible Elemente umbrechen sollen oder nicht. Mögliche Werte sind: nowrap wrap wrap-reverse initial inheritPlay it »
initialVerwendet den Standardwert der Eigenschaft.Play it »
inheritErbt die Eigenschaft vom übergeordneten Element.

Practice

What is correct about the 'flex-flow' property in CSS?

Finden Sie das nützlich?

Dual-run-Vorschau — vergleichen Sie mit den Symfony-Routen live.