Use CSS Grid to Rebuild the Trello User Interface

Use CSS Grid to Rebuild the Trello User Interface

I love CSS Grid — you can build almost any layout you can dream up with it! Today I want to deconstruct Trello's main user interface and rebuild

I love CSS Grid — you can build almost any layout you can dream up with it! Today I want to deconstruct Trello’s main user interface and rebuild it using CSS Grid as the main foundational component.

Normally, I develop using React and styled-components, but to allow this guide to be as portable as possible, I’ll be using just plain divs and CSS classes!

Breaking Down the Interface

To start off, let’s break down a screenshot of the main user interface into the main divs that make up the overall structure. Let’s start off with a div that takes up the entire viewport:

trello-empty.html

<!-- css -->

.base {
  height: 100vh;
  width: 100vw;
}

<!-- html -->

<div class="base">
  
</div>

At the highest level, we have two major sections: the top-level header and the board section.


The header section is highlighted in green and the board section is highlighted in orange.

The Header

Let’s start with the header. There are three distinct parts to it: the left-aligned controls, the logo in the center, and the right-aligned buttons on the right.

To set up this div, we’ll use the following properties:

.header {
  display: grid;
  grid-template-columns: 2fr 1fr 2fr;
}

Firstly, to use CSS Grid, we need to use display: grid; — this allows all of the other grid-related CSS properties to take effect.

The next property we are using is grid-template-columns. This property allows us to list out values that will be used as the definitions of the columns of the grid. Since we’ve provided three values, there will be three columns.

One tricky bit here is that we’re trying to get the logo to always be in the center. We’re going to accomplish this by using the fr unit. It stands for fractional unit, and refers to remaining space.

So, since we have three columns, one at 2fr, another at 1fr, and another at 2fr, that totals to five parts, where the first one will occupy 2/5, the second will occupy 1/5, and the third will occupy 2/5.

Why this helps us keep the logo in the middle is that the left section will always be equal to the right section. We could also just as easily make all three columns the same width, but the logo is pretty small, so we’ll give the side sections more room.

It looks like this:

It’s getting there, but the logo isn’t centered and the right-aligned buttons aren’t quite right-aligned. We’ll add the following:

.header .logo {
  justify-self: center;
}
.header .right-aligned {
  justify-self: flex-end;
}

In CSS Grids, the justify-items and justify-self properties refer to horizontal alignment and align-items and align-self properties refer to vertical alignment.

With some colors thrown in to help visualize where the block elements are, we now have:


Getting closer! The buttons are next.

The Header Buttons

The left-aligned controls in the header look like this:


A home button, a button to open all boards, and a search bar.

To implement this using CSS Grid, we’ll use the following:

.header .left-aligned {
  display: grid;
  grid-gap: 5px;
  grid-template-columns: repeat(3, auto);
}

Again, we’re using grid-template-columns to define three columns — one for each of the three controls.

This time however, since I just want them to be auto, I can just use repeat(3, auto) to generate three columns all set to auto. To space out the grid items, instead of using margins, we’ll use grid-gap.

For good measure, we’ll also change the header text color to white and add rounded corners to these divs:


This is mostly a layouts exercise, so we’ll just use a text placeholder.

No margins needed! We’ll use a similar approach for the logo and the right-aligned buttons:


The header layout is finished!

The Board Header

The next part we need to address is the board. It has a header and a “body” part, so let’s break this div down into a grid with two rows:

.board {
  display: grid;
  grid-template-rows: max-content auto;
}

We want to use max-content for the first row because we don’t need it to be bigger than the height of its content, and we’ll use auto for the body section to let it take up the rest of the space.

The main header was a similar approach so let’s cut to the chase with putting the board header together (and let’s start using Trello’s font too!):

The main difference this time is that we don’t have to worry about centering the logo, so we used the following:

.board-header {
  display: grid;
  grid-template-columns: repeat(2, auto);
}
.board-header .left {
  display: grid;
  grid-template-columns: repeat(4, max-content);
  grid-gap: 10px;
  justify-self: left;
}
.board-header .right {
  display: grid;
  grid-template-columns: repeat(2, max-content);
  grid-gap: 10px;
  justify-self: right;
}

The whole header is divided into two, and the left section is justified left and the right section is justified right.

The Board

The board is the most interesting part of the whole user interface. It’s composed of an indeterminate number of columns, separated by a small gap.

Each list is 272px wide and the gap between them is 8px. We’ll use the following to lay out the lists:

.board-lists {
  display: grid;
  grid-auto-columns: 272px;
  grid-auto-flow: column;
  grid-gap: 8px;
}

Even though this appears to be the most involved part of the user interface, it’s very straightforward using CSS Grid! grid-auto-columns automatically creates columns of the same width, and the value passed is 272px.

grid-auto-flow = column forces the grid to stay as columns, never wrapping around to form a two-dimensional grid. And finally, grid-gap instead of margins or padding to separate the columns.


Getting close to the end!

One more thing that we don’t have yet in our prototype is horizontal scrolling of the lists. We’ll use overflow: scroll;:

Without this, the grid would extend off the right side of the screen.

The Lists

The lists are a series of card blocks, stacked vertically with a title on the top and an “+ Add another card” click area at the bottom. To accomplish this, we’ll use the following:

.board-list {
  display: grid;
  grid-auto-rows: max-content;
  grid-gap: 10px;
  padding: 10px;
}

Much like grid-auto-columns, grid-auto-rows makes a grid of rows with a specific height. Choosing max-content sets the rows to be as big as their content. There’s a 10px gap between the cards — again, no need for margins!

And just like that (with a little bit of box-shadow and padding on the cards, and bolding on the list title), we’ve done the entire layout!

Final Result Comparison

7 Best Vue CSS Component for Your App

7 Best Vue CSS Component for Your App

Vue CSS frameworks are great for many reasons; code is more universally understood, web applications are easier to maintain, and prototyping becomes less of an extra step.

Vue CSS frameworks are great for many reasons; code is more universally understood, web applications are easier to maintain, and prototyping becomes less of an extra step and more part of the development process.

1. Tailwindcss-Vue

Tailwindcss-Vue is a library of UI components for Vue.js built using the Tailwind CSS utility-first CSS framework.

Download: https://github.com/advanced-data-machines/tailwindcss-vue/archive/master.zip

2. @zeit-ui/vue

Vue implementation for Zeit Style, originating from Zeit Design.

@zeit-ui/vue is a Vue implementation for zeit style, originating from Zeit Design. Lean more at GITHUB.

The design of the Zeit is concise and aesthetic feeling, this is an important reason for popular of Zeit. Now you can use them through the @zeit-ui/vue.

Download: https://github.com/zeit-ui/vue/archive/master.zip

3. CSSeffectsSnippets

Click on the animation to copy it to your clipboard

Demo: https://emilkowalski.github.io/css-effects-snippets/

Download: https://github.com/emilkowalski/css-effects-snippets/archive/master.zip

4. Vue Cirrus

A fully responsive and comprehensive CSS framework with beautiful controls and simplistic structure. Cirrus is designed to be adaptable to existing themes or when starting fresh. These are the Vue Components for this CSS framework.

Demo: https://florianwoelki.github.io/vue-cirrus/#/

Download: https://github.com/FlorianWoelki/vue-cirrus/archive/master.zip

5. Vue CSS Modules

Seamless mapping of class names to CSS modules inside of Vue components.

Download: https://github.com/fjc0k/vue-css-modules/archive/master.zip

6. BG MixMaster 90 — CSS Background Grid /Pattern Generator

make a background grid (like graph paper) using only one background gradient property and ended up with this killer mix tape for making all kinds of background grids and patterns.

Download: https://codepen.io/jasesmith/pen/YZEYRL

7. CSSOBJ

CSS Rules from JS, change rules dynamically, CSSOM, css modules, auto vendor prefixer, media query for old browsers.

CSS in JS solution, create CSSOM and CSS rules from js, features:

  • CSS Rules create and diff
  • CSS modules with local class
  • Auto vendor prefixer
  • Media query for old browsers
  • Dynamically change CSS

Demo: https://cssobj.github.io/cssobj-demo/

Download: https://github.com/cssobj/cssobj/archive/master.zip

Guide to Python Programming Language

Guide to Python Programming Language

Guide to Python Programming Language

Description
The course will lead you from beginning level to advance in Python Programming Language. You do not need any prior knowledge on Python or any programming language or even programming to join the course and become an expert on the topic.

The course is begin continuously developing by adding lectures regularly.

Please see the Promo and free sample video to get to know more.

Hope you will enjoy it.

Basic knowledge
An Enthusiast Mind
A Computer
Basic Knowledge To Use Computer
Internet Connection
What will you learn
Will Be Expert On Python Programming Language
Build Application On Python Programming Language

Learn Python Programming

Learn Python Programming

Learn Python Programming

Description
Learn Python Programming

Learn Python Programming and increase your python programming skills with Coder Kovid.

Python is the highest growing programming language in this era. You can use Python to do everything like, web development, software development, cognitive development, machine learning, artificial intelligence, etc. You should learn python programming and increase your skills of programming.

In this course of learn python programming you don't need any prior programming knowledge. Every beginner can start with.

Basic knowledge
No prior knowledge needed to learn this course
What will you learn
Write Basic Syntax of Python Programming
Create Basic Real World Application
Program in a fluent manner
Get Familiar in Programming Environment