Why Assignment Of Contracts Are a Great Deal in 2019

The purchase of Pre-Sale Condos was a very popular (and still is) strategy that many investors were taking part of in the last few years here in the lower mainland. The goal is to lock down a condo…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Create a Responsive Photo Feed with CSS Grid in 5 minutes

Grid design is so common in responsive web design. We usually have to rely heavily on outside libraries like Bootstrap to help us create grid layouts. But that isn’t the case anymore, for the first time ever we now have a way to build out grid layouts natively in the browser using CSS Grid.

In this article, you will learn how to use and interact with CSS Grid in minutes by building out a tiled responsive photo feed. To keep this quick and easy I wont be covering everything in CSS Grid but just enough for you to be dangerous.

Here’s what we’ll be building:

Here you can see that we have a parent div named container. This will be our actual grid. The images are just the content inside of the grid. To convert the container div to a CSS Grid we will use the code below:

Ok now refresh the page. Still looks the same. Nothing has happened yet because we didn’t tell our grid what it is supposed to look like just yet.

For our grid we are going to make it 3 x 2 for that we will use two properties: grid-template-row and grid-template-column.

Refresh the page again. Now we are getting somewhere. You should see our images in a grid layout with three columns.

Now that we have our grid. We want to be able to tile our images. This is where CSS Grid get’s really cool.

To change the width of picture number one we will add the following code:

What this will do is extend the first image across the entire row. You are telling the grid that the image will start at the first grid line and end at the third grid line. Here’s how it will look.

Let’s do some more rearranging:

Notice we threw in a new property grid-row-start it has the same functionality as grid-column-startbut allows you to define how many rows a grid item will take up instead of a column. Let’s take a look at what that just did:

We can also add a gap in between our photos by adding:

Awesome! You now have an awesome photo layout built with CSS Grid.

If you have any questions feel free to ask them below!

Add a comment

Related posts:

Presenting Pujie Black 4.0

We are ready to present you Pujie Black 4.0. It is truly a feature packed release, with Image Layers, Automation, A Cloud Library and Custom Complications.

9 Reasons to Quit Your Job

2017 got trashy real quick. Through the dump site that was my life, I managed to piece together some of my journal entries during the last few months of my job as a Human Resources Supervisor. I…