You might not need a CSS framework

@ladybenko

belen@mozilla.com

UX frameworks

Why people use them?

Some of the problems…

Layouts

Today: meet flexbox!

Holy Grail with flexbox

<header class="main-header">Header</header>
<div class="row">
  <aside class="primary-sidebar">Sidebar (left)</aside>
  <main class="content">Main content goes here</main>
  <aside class="secondary-sidebar">Sidebar (right)</aside>
</div>
<footer class="main-footer">Footer</footer>
body {
  height: 100vh;
  display: flex;
  flex-direction: column;
  text-align: center;
}

.row { flex: 1 1 auto; }

.main-header, .main-footer {
  flex: 0 0 auto;
}
.row { display: flex; }

.primary-sidebar, .secondary-sidebar {
  flex: 0 0 auto;
  width: 250px;
}

.content {
  flex: 1 1 auto;
  min-width: 400px;
}

Can I use it?

How to use it?

Tomorrow: grid!

Holy Grail with grid

<header class="main-header">Header</header>
<main class="content">Main content goes here</main>
<aside class="primary-sidebar">Sidebar (left)</aside>
<aside class="secondary-sidebar">Sidebar (right)</aside>
<footer class="main-footer">Footer</footer>
body {
  height: 100vh;
  display: grid;
  grid-template-columns: 250px 1fr 250px;
  grid-template-rows: auto 1fr auto;
  grid-template-areas:
    "h h h"
    "l c r"
    "f f f";
}
.main-header { grid-area: h; }
.main-footer { grid-area: f; }
.primary-sidebar { grid-area: l; }
.secondary-sidebar { grid-area: r; }
.content { grid-area: c; }

How to use it?

If you just need a grid

You don't need a whole UX framework

UI components

If you have a custom design…

Wouldn't it be better to implement it from scratch?

If you just need a few UI components…

If you have a big, complex project

Thanks!

Questions?