How to create a responsive Wrap Panel in #HTML using the #CSS Flexbox Layout?

How to create a responsive Wrap Panel in #HTML using the #CSS Flexbox Layout?

In HTML, generally we use the following layout display modes: none, block, inline, table and positioned. There exists one layout module, named Flexible Box Layout, which allows you to create a flexible layout and make it as a Wrap Panel.


In this blog post, we will learn about Flex Box Layout and how to use it to create a wrap panel by just using HTML and CSS.


How to create HTML WrapPanel using the CSS Flexbox Layout?


The Flexible Box Layout Module, makes it easier to design a flexible responsive layout without using the float property of CSS. To begin with this, you will need a container. You can define your parent <div/> container with a CSS property display:flex; to create the flex layout.


You can then use the flex-wrap property on the parent container to define whether the flex items should wrap or not. Here's a list of important flex-wrap property values, that you must need to know:

  • The default value nowrap specifies that the flex items will not wrap.
  • The value wrap specifies that the flex items will wrap, if necessary.
  • The value wrap-reverse specifies that the flex items will wrap in reverse order.


Let's go by an example. Consider the following CSS Style, which contains a style for the parent container. The display:flex; makes it responsive and the flex-wrap:wrap; makes it wrapable container.


  #wrappanel {
  #wrappanel .thumbnail {


As the CSS is ready, let's go to the HTML to create the layout. First add a <div> with an ID as wrappanel and then add some <div/> tags as children to the parent <div>. Set the class of the child divs to thumbnail. As per our CSS, the thumbnail div's will have 300x150 px dimension and an orange background. Here's the HTML code for your reference:


<div id="wrappanel">
  <div class="thumbnail">&#160;</div>
  <div class="thumbnail">&#160;</div>
  <div class="thumbnail">&#160;</div>
  <div class="thumbnail">&#160;</div>
  <div class="thumbnail">&#160;</div>


Now, if you open render the created HTML page, you will see five rectangles inside the page. Resize the page to see how this arrange themselves and wraps automatically based on the page size.


Was the post helpful? Do let me know your comments. To know more about this flex-layout, check the flex property page available on



If you have come this far, it means that you liked what you are reading. Why not reach little more and connect with me directly on Twitter, Facebook, Google+ and LinkedIn. I would love to hear your thoughts and opinions on my articles directly.

Also, don't forget to share your views and/or feedback in the comment section below.


© 2008-2018 - Microsoft Technology Blog for developers and consumers | Designed by Kunal Chowdhury
Back to top