HTML | DOM Style flexFlow Property

The Style flexFlow property in HTML DOM is used to specify the value for two different properties flexDirection property and flexWrap property. The flexDirection property is used to specify the direction of flexible items and flexWrap property is used to specify the flexible item should wrap or not.

Syntax:

  • It returns the string which represents the flexFlow property of an element.
    object.style.flexFlow
  • It is used to set the flexFlow property value.
    object.style.flexFlow = "flex-direction flex-wrap|initial|
    inherit"

Property Values:



  • flex-direction flex-wrap: The flewFlow property is the combination of flexDirection and flexWrap property. The default value of flex-direction flex-wrap is row nowrap. Following are the list of possible values of flexDirection and flexWrap properties.
    flex-direction = "row |row-reverse |column |column-reverse |
    initial |inherit";
    flex-wrap = "nowrap |wrap |wrap-reverse |initial |inherit";

    Example 1: It changes the flexFlow property value from “row wrap” to “column wrap”.

    filter_none

    edit
    close

    play_arrow

    link
    brightness_4
    code

    <!DOCTYPE html>
    <html>
          
    <head>
        <title>
            HTML DOM Style flexFlow Property
        </title>
          
        <style
            #GFG {
                width: 220px;
                height: 150px;
                border: 2px solid black;
                  
                 /* For Safari browsers */
                display: -webkit-flex;
                  
                 /* For Safari 6.1+ browsers  */
                -webkit-flex-flow: row wrap;
                display: flex;
                flex-flow: row wrap;
            }
            #GFG div {
                width: 50px;
                height: 70px;
            }
        </style>
    </head>
      
    <body>
        <div id="GFG">
            <div style="background-color:lightgreen;">G</div>
            <div style="background-color:green;">E</div>
            <div style="background-color:lightgreen;">E</div>
            <div style="background-color:green;">K</div>
            <div style="background-color:lightgreen;">S</div>
        </div>
          
        <button onclick="myGeek()">
            Click Here
        </button>
          
        <script>
            function myGeek() {
                  
                /* For Safari Browsers */
                document.getElementById("GFG").style.WebkitFlexFlow
                        = "column wrap";
                  
                document.getElementById("GFG").style.FlexFlow
                        = "column wrap";
            }
        </script>
    </body>
      
    </html>                    

    chevron_right

    
    

    Output:
    Before click on the button:

    After click on the button:

  • Example 2: It changes the flexFlow property value from “row wrap” to “row-reverse wrap-reverse”.
    filter_none

    edit
    close

    play_arrow

    link
    brightness_4
    code

    <!DOCTYPE html>
    <html>
          
    <head>
        <title>
            HTML DOM Style flexFlow Property
        </title>
          
        <style
            #GFG {
                width: 220px;
                height: 150px;
                border: 2px solid black;
                  
                 /* For Safari browsers */
                display: -webkit-flex;
                  
                 /* For Safari 6.1+ browsers  */
                -webkit-flex-flow: row wrap;
                display: flex;
                flex-flow: row wrap;
            }
            #GFG div {
                width: 50px;
                height: 70px;
            }
        </style>
    </head>
      
    <body>
        <div id="GFG">
            <div style="background-color:lightgreen;">G</div>
            <div style="background-color:green;">E</div>
            <div style="background-color:lightgreen;">E</div>
            <div style="background-color:green;">K</div>
            <div style="background-color:lightgreen;">S</div>
        </div>
          
        <button onclick="myGeek()">
            Click Here
        </button>
          
        <script>
            function myGeek() {
                  
                /* For Safari Browsers */
                document.getElementById("GFG").style.WebkitFlexFlow
                        = "row-reverse wrap-reverse";
                  
                document.getElementById("GFG").style.FlexFlow
                        = "row-reverse wrap-reverse";
            }
        </script>
    </body>
      
    </html>                    

    chevron_right

    
    

    Output:
    Before click on the button:

    After click on the button:

  • initial: It set the flexFlow property to its default value.
    Example 3:

    filter_none

    edit
    close

    play_arrow

    link
    brightness_4
    code

    <!DOCTYPE html>
    <html>
          
    <head>
        <title>
            HTML DOM Style flexFlow Property
        </title>
          
        <style
            #GFG {
                width: 220px;
                height: 150px;
                border: 2px solid black;
                  
                 /* For Safari browsers */
                display: -webkit-flex;
                  
                 /* For Safari 6.1+ browsers  */
                -webkit-flex-flow: row wrap;
                display: flex;
                flex-flow: row wrap;
            }
            #GFG div {
                width: 50px;
                height: 70px;
            }
        </style>
    </head>
      
    <body>
        <div id="GFG">
            <div style="background-color:lightgreen;">G</div>
            <div style="background-color:green;">E</div>
            <div style="background-color:lightgreen;">E</div>
            <div style="background-color:green;">K</div>
            <div style="background-color:lightgreen;">S</div>
        </div>
          
        <button onclick="myGeek()">
            Click Here
        </button>
          
        <script>
            function myGeek() {
                  
                /* For Safari Browsers */
                document.getElementById("GFG").style.WebkitFlexFlow
                        = "initial";
                  
                document.getElementById("GFG").style.FlexFlow
                        = "initial";
            }
        </script>
    </body>
      
    </html>                    

    chevron_right

    
    

    Output:
    Before click on the button:

    After click on the button:

  • inherit: It inherits the property from its parent element.

    Example 4:

    filter_none

    edit
    close

    play_arrow

    link
    brightness_4
    code

    <!DOCTYPE html>
    <html>
          
    <head>
        <title>
            HTML DOM Style flexFlow Property
        </title>
          
        <style
            #GFG {
                width: 220px;
                height: 150px;
                border: 2px solid black;
                  
                 /* For Safari browsers */
                display: -webkit-flex;
                  
                 /* For Safari 6.1+ browsers  */
                -webkit-flex-flow: row wrap;
                display: flex;
                flex-flow: row wrap;
            }
            #GFG div {
                width: 50px;
                height: 70px;
            }
        </style>
    </head>
      
    <body>
        <div id="GFG">
            <div style="background-color:lightgreen;">G</div>
            <div style="background-color:green;">E</div>
            <div style="background-color:lightgreen;">E</div>
            <div style="background-color:green;">K</div>
            <div style="background-color:lightgreen;">S</div>
        </div>
          
        <button onclick="myGeek()">
            Click Here
        </button>
          
        <script>
            function myGeek() {
                  
                /* For Safari Browsers */
                document.getElementById("GFG").style.WebkitFlexFlow
                        = "inherit";
                  
                document.getElementById("GFG").style.FlexFlow
                        = "inherit";
            }
        </script>
    </body>
      
    </html>                    

    chevron_right

    
    

    Output:
    Before click on the button:

    After click on the button:

Supported Browsers: The browser supported by DOM Style flexFlow property are listed below:

  • Google Chrome
  • Internet Explorer 11.0
  • Firefox
  • Opera
  • Safari 6.1 WebkitFlexFlow


My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.




Article Tags :
Practice Tags :


Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.