About using float

The single biggest reason for weird bugs my students had today was css float. Using float is often not needed, as display: inline or display: inline-block often achieves the same things. It is however, sometimes, very useful, but there are some caveats that you need to avoid.

  1. Always try to put floating elements inside a wrapping div.
  2. Try to keep the floated elements seperate from other, non-floaty, elements.
  3. This wrapping div should always have overflow: hidden, to avoid a whole range of strange bugs.

Here’s an example of a simple sidebar using float:

<div id="container">
	<div id="sidebar">
		<p>This is a sidebar</p>
	<div id="content">
		<p>Lorem ipsum osv</p>
#container {
	overflow: hidden;
#sidebar, #content {
	float: left;
#sidebar {
	background-color: #f0f000;
	width: 100px;
#content {
	background-color: #00f0f0;
	width: calc(100% - 100px);

Moving a folder to its own git repo

Today I wanted to move a folder in a git repo to its own repo, but keep all history. I luckliy found a handy stackoverflow guide to help me =)

Create a submodule repository from a folder

New layout

I changed the layout of the blog since I couldn’t be bothered to actually fix anything on it. This is the Hyde theme for poole, which seems to work nicely.

Init and pull all git submodules

I always seem to forget some commands. How to pull all the submodules in my dotfiles git repo is something I have to look up every time.

So, mostly for my own future reference, this is the commands used to initialise submodules after a repo has been cloned:

git submodule init

git submodule update --recursive