DEV Community

Cover image for INTRODUCTION TO FLEXBOX
milky121
milky121

Posted on

INTRODUCTION TO FLEXBOX

INTRODUCTION

As we see,there are many ways to move elements around on a webpage
but FLEXBOX is a relatively new way of manipulating elements in css and when it was introduced, it was revolutionary.

           The FLEXBOX layout used today is very different what was first proposed, the CSS WORKING GROUP had proposed the idea of a flex layout in 2008 and publishing the first working draft in 2009.
           But nowadays, flexbox become the default way of positioning elements for many developers.It will be one of the most used tools in your toolbox.
Enter fullscreen mode Exit fullscreen mode

FLEXBOX

It is a way to arrange items into rows or columns, where those items will flex(i.e grow or shrink)based on simple rule.

         <div class="flex-container>
            <div class="one"></div>
            <div class="two"></div>
            <div class="three></div>
       </div>
Enter fullscreen mode Exit fullscreen mode

If you add another div to the HTML, inside of .flex-container, it will show up alongside the others and everything will flex to make it fit.

FLEX CONTAINERS AND FLEX ITEMS

A flex containers is any elements that has display:flex on it.
A flex item is any element that lives directly inside of a flex container.

Image description

   Somewhat confusingly, any element can be both a container and a item.
Enter fullscreen mode Exit fullscreen mode

Image description

       This method of creating and nesting multiple flex, containers and items is a primary way we will be building up complex layouts.Hence FLEXBOX is a very powerful tool...
Enter fullscreen mode Exit fullscreen mode

thank you...

Top comments (0)