HTML Editor
<!DOCTYPE html> <html lang="en-US"> <head> <style> #parent{ display: flex; width: 100%; border: 1px solid #8c8c8c; } #parent > div{ height: 90px; border: 1px solid #8c8c8c; margin: 10px; flex-grow: 1; -webkit-flex-grow: 1; } </style> </head> <body> <h1>CSS flex-grow Property</h1> <div id="parent"> <div>Div 1</div> <div>Div 2</div> <div>Div 3</div> </div> <button onclick="myFunction()">Click Me</button> <script> var x = document.getElementById("parent").firstElementChild; function myFunction(){ x.style.flexGrow = "2"; x.style.WebkitFlexGrow = "2"; } </script> <p><strong>Note</strong>: Click on the button to change the 'flex-grow' of the first child element from 1 to 2.</p> </body> </html>
OUTPUT
×

Save as Private