CSS Flex Box

CSS Flex Box

ยท

1 min read

Table of contents

No heading

No headings in the article.

The flexbox in CSS is a one-dimensional model, it contains flexible and efficient layouts.It is a layout model which provide easy way to arrange items in a container.Flexbox is useful to create small scale layout and responsive layouts.

๐…๐ž๐š๐ญ๐ฎ๐ซ๐ž๐ฌ ๐จ๐Ÿ ๐…๐ฅ๐ž๐ฑ ๐๐จ๐ฑ

Here are the features of flex Box.

  • Flexibility

  • Arrangement of items.

  • Order and sequencing of items.

  • Proper spacing

๐‚๐จ๐ฆ๐ฉ๐จ๐ง๐ž๐ง๐ญ๐ฌ ๐จ๐Ÿ ๐…๐ฅ๐ž๐ฑ ๐๐จ๐ฑ

Majorly Here are two types of components in flexbox which are following.

๐Ÿ. ๐…๐ฅ๐ž๐ฑ ๐‚๐จ๐ง๐ญ๐š๐ข๐ง๐ž๐ซ

Flex container is parent div which contains various divisions in itself.

๐Ÿ. ๐…๐ฅ๐ž๐ฑ ๐ˆ๐ญ๐ž๐ฆ๐ฌ

Flex items are the items which are inside of the container div.

Here is the example for creating flex Box.

<html>
<head>
<title>CSS Flex Box</title>
<style>
    .container{
        display : flex;
        flex-direction: row;
        background-color : #000;
    }
    .item{
        background-color:#EB4D4B;
        margin : 10px;
        padding : 10px;
    }
</style>
</head>
<body>
<h1>Hello CSS FlexBox</h1>
<div class="container">
    <div class="item">Item1</div>
    <div class="item">Item2</div>
    <div class="item">Item3</div>
</div>
</body>
</html>

๐…๐ฅ๐ž๐ฑ ๐๐จ๐ฑ ๐€๐ฑ๐ž๐ฌ

Whenever we work with flexbox,we always deal with two axex,which are following.

๐Ÿ. ๐Œ๐š๐ข๐ง ๐€๐ฑ๐ž๐ฌ

๐Ÿ. ๐‚๐ซ๐จ๐ฌ๐ฌ ๐€๐ฑ๐ž๐ฌ

Some of the properties of flex Box are following.

flex-direction:row;
flex-direction:row-reverse;
flex-direction:column;
flex-direction:column-reverse;
justify-content:center;
align-item:center;
ย