Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,150,593 members, 7,809,148 topics. Date: Friday, 26 April 2024 at 01:23 AM

Build A Responsive Music App By Understanding Flexbox - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Build A Responsive Music App By Understanding Flexbox (1090 Views)

Flexbox Is Underrated. Here's The Skeleton Of An Image Gallery I Created. / A Nairalander Creates A Music App Using React And Django REST / Flexbox And Grid CSS (2) (3) (4)

(1) (Reply)

Build A Responsive Music App By Understanding Flexbox by tatoxiza: 9:39am On Oct 26, 2017
Why Use Flexbox?
CSS has evolved a lot over the past few years. Designers loved the introduction of filters, transitions, and transforms. But something was missing. Something we all craved.

The problem of crafting intelligent page layouts with CSS seemed to have persisted for too long, and this got many of us writing hacky CSS.

We always had to deal with floats, table display hacks, and the consequences they brought. If you’ve written CSS for sometime, you can probably relate to this. And if not, welcome to a better world!

It seems like our prayers as designers and front-end developers have finally been heard. This time, in grand style.

Now we can all ditch those hacky CSS tricks. No more incessant use of floats, table-cell displays.

It’s time to embrace a cleaner modern syntax for crafting intelligent layouts. Welcome the CSS Flexbox model.

What Is Flexbox?
According to the specification, the flexbox model provides for an efficient way to layout, align, and distribute space among elements within your document, even when the viewport and the size of your elements is dynamic or unknown.

If that sound too formal, I understand the feeling. In just a bit, I’ll explain what that means in plain English.

Whether you write css in your dreams or you’re just getting started, you’ll feel right at home.

How do I start using the flexbox model?
This is the first question everyone asks, and the answer is much simpler than you may have expected.

To start using the Flexbox model, all you need to do is first define a flex-container.

Okay, did I make you more confused there? Let me explain.

In regular HTML, laying out a simple list of items takes this form.

Re: Build A Responsive Music App By Understanding Flexbox by tatoxiza: 10:21am On Oct 26, 2017
<ul> <!--parent element-->
<li></li> <!--first child element-->
<li></li> <!--second child element-->
<li></li> <!--third child element-->
</ul>

If you glanced at that, you must have seen that the unordered list, ul houses the list elements, li.

You’d call the ul the parent element, and the li the child element.

To use the flexbox model, you must make a parent element a flex container (aka flexible container).

You do this by setting display: flex or display: inline-flex for the inline variation. It’s that simple, and from there you’re all set to use the Flexbox model.

Told you it wasn’t as difficult as you expected.
Set a certain parent element to be a flex-container by using display : flex || inline-flex
Using an unordered list and a bunch of list elements, below is what initiating a Flexbox formatting context looks like.

/*Make parent element a flex container*/
ul {
display: flex; /*or inline-flex*/
}

Style the list items just a bit, so you may see what’s going on here.
li {
width: 100px;
height: 100px;
background-color: #8cacea;
margin: 8px;
}
Re: Build A Responsive Music App By Understanding Flexbox by melodyogonna(m): 8:43am On Oct 27, 2017
Thanks for this piece OP, this board is coming back to life

(1) (Reply)

Learn To Code Java The Right Way / anyone going For Pycon Usa Cleveland ? / Need A Programmer Who Can Help Me Build A Small Social Media Platform

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 15
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.