Skip to content
Related Articles

Related Articles

HTML | DOM Style flexFlow Property
  • Last Updated : 31 Jul, 2019

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”.




    <!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>                    

    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”.




    <!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>                    

    Output:
    Before click on the button:

    After click on the button:

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




    <!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>                    

    Output:
    Before click on the button:

    After click on the button:

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

    Example 4:




    <!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>                    

    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
Recommended Articles
Page :