Full stack web developer, interested in all the things, but especially the web, code, design, Linux, OS X, PHP, WordPress, JavaScript & robots.

How to Center in CSS image/svg+xml

Centering in CSS is a pain in the ass. There seems to be a gazillion ways to do it, depending on a variety of factors. This consolidates them and gives you the code you need for each situation.

It is true, centring in CSS can be a PITA, but like most things in life, once you know how, it’s easy. Until you learn how, or if you forget how, or if you can’t be bothered to commit how to memory, this tool may come in handy.

Admission: I hardly ever remember how to vertically centre elements in CSS, but in my defence, it’s not something I do all that often.


Leave a comment

Your email address will not be published. Required fields are marked *