Flexbox CSS justify-content:space-*

Flexbox CSS justify-content:space-*

Flexbox layout and its properties are a set of properties which helps to align flex-items in a container. As we have discussed in detail in  our previous articles
i) flexbox is a set of properties
ii) it helps to align grid elements in a container in may ways
iii) it also helps to realign the way it is arranged in a mobile or responsive screen  without writing too much of code.

Justify-content

Justify-content is the property provided by flexbox concept which works like text-align property.
Justify -around takes up the following values
justify-content: center | flex-start | flex-end | space-around | space-between | space-evenly 
    





justify-content: space-*

justify-content: space-* helps us to align flex-items horizontally between the flex-container. In other words, it deals with the horizontal alignment within the container

justify-content: space-around

space-around helps us to align items in such a way that items have equal space around them.
The space between the items and the flex-container will be 1x, whereas space-between any two flex-items will be 2x.
Example
CSS3 Flexbox
Example with number of flex-items changed
CSS3 Flexbox

justify-content: space-evenly

space-evenly helps us to align items in such a way that items have even space between them. The flex-items will have 1x space between any two flex-items and the flex-items and flex-container edges.
CSS3 Flexbox
Another example showing justify-content:space-evenly
CSS3 Flexbox
Do you know
Recently, space-evenly has been made support and compatible with all modern browsers.

justify-content:space-between

space-between aligns the flex-items within the flex-container in such a way that space is allotted in between flex-items and not between the edges of the flex-container and the flex-items in the edges. The items in the edges move towards the edges in the left and right side respectively making space in between the flex items.
Example for justify-content:space-between
CSS3 Flexbox

Flex box also provides way to order the flex-items by giving a numeric value thereby aligning elements in responsive using flexbox very easy.
________________

Feel free to ask your doubts and share your feedback

Follow our FB page @CreativeTechnocrayts
Subscribe to Creative Technocrayts and be a part of growing community.

Comments

Popular posts from this blog

What are some mistakes people make when they start learning HTML, CSS and JavaScript?

How to initialize Datatable plugin?

Datatables.net - Plugin options