Flexbox is a great way to make a site responsive. The size, spacing and positioning of the boxes can be adjusted according to the screen size.
This is tutorial by CSS-Tricks gives a good overview of how to implement this CSS class and its attributes.
Adding the property display: flex to the parent element makes it a flex container. All underlying children are automatically flex items.
Properties of the flex container
flex-direction
row (default): left to right.
row-reverse: right to left.
column: top to bottom.
column-reverse: bottom to top.
flex-wrap
wrap
wrap-reverse
nowrap (default)
flex-flow: combines both the flex-direction and flex-wrap in a single property.
justify-content: horizontal alignment of the elements.
flex-start: to the left.
flex-end: to the right.
center: in the center.
space-between: evenly distributed with first element at the start and last element at the end.
space-around: evenly distributed with equal space around them.
space-evenly: spacing between any two elements (and the space to the edges) is equal.
align-items: vertical alignment of the elements.
flex-start: at the top.
flex-end: at the bottom.
center: centered.
baseline: baseline of the elements are aligned.
stretch: stretch vertically to fill the container.
align-content: vertical alignment when there are multiple rows.
flex-start: to the start of the container.
flex-end: to the end of the container.
center: to the center of the container.
space-between: evenly distributed.
space-around: evenly distributed with equal space around each line.
stretch (default): stretch to take up the remaining space.
Properties of the flex item
order: change the order of the items.
flex-grow: allows item to grow by setting a relative number.
flex-shrink: allows item to shrink.
flex-basis: default size of an item before the remaining space is distributed. Can be set in percentage, rem, etc. If it is set to auto it looks at the width and height property of the item.
flex: combines flex-grow, flex-shrink and flex-basis. Default is 0 1 auto.
align-self: vertically align an individual item.
Examples
Following the CSS-Tricks tutorial I created some examples using the flexbox class.
col-xs-12: on an extra small screen device (phone) the column width will be equal to the row width, i.e. all boxes will be below one another in a single column.
col-sm-6: on a small device (tablet) the column width will be 6, so there are 2 columns with 2 boxes each.
col-md-3: on a medium device (laptop or desktop) the width will be 3, showing the boxes on a single row.
Ok, I have to admit it took me some time to set up this site using Jekyll. The installation was actually pretty straightforward. But then you’re stuck with a generic blog template and have no idea how to customize it.
Installing a new theme
Being used to WordPress I mistakenly thought that I just would have to import some theme zip file, adjust some settings in the config file and commit the changes. Would that it were so simple!
Some themes can be installed using a ruby gem. I tried doing this with several themes on this list, but with little success. Another option that was suggested in Stack Overflow involved making a branch of the existing git repository, pulling in the new theme and then merging the changes. This seems like the correct way of handling a theme change, but a bit complex for someone just getting started with Git.
In the end I just found a theme I liked, cloned it to a local directory and started customising it.
Because I had cloned the repo, it was still linked to the original remote of the theme developer. To publish it with GitHub Pages I needed to link it to my own remote. I’m sure there’s a better way to do this, but I just made a new directory copied all the files into it and initiated a new git repo. Then I added my own remote to publish the site.
Why did I choose Jekyll to build my site?
The main reason I initially became interested in Jekyll is that it allows you to build a minimalist static site. Even though this proved to be harder than I thought, it was a good learning process.
For an aspiring developer Jekyll is actually the perfect way to build a site. It forces you to use essential developer tools like the command line, Git and a (markdown) text editor.
As part of the Odin Project curriculum I had to replicate the Google home page using html and css. You can see the result here.
The most difficult part was figuring out how to add the top and bottom navigation bars. There are many different ways to do this, for example using the html5 <nav> tag. I just used a regular unordered list <ul> with <li> items. Then I removed all the styling in css.