CSS Flexbox - Use display: flex to Position Two Boxes
CSS Flexbox - Use display: flex to Position Two Boxes
Placing the CSS property
display: flex; on an element allows you to use other flex properties to build a responsive page. imagine you have to divs that want to display side by side in one container
first we should give
display: flex; on that container and give 50% for width and height for both contained boxes as follow:<style> #box-container { height: 500px; display:flex; } #box-1 { background-color: dodgerblue; width: 50%; height: 50%; } #box-2 { background-color: orangered; width: 50%; height: 50%; } </style> <div id="box-container"> <div id="box-1"></div> <div id="box-2"></div> </div>
see the result now for that code
Comments
Post a Comment