News for hackers. Stuff that matters.
Re:How to Center in CSS by talideon on Saturday May 14, 2016 @08:36PM (#11698736)
There's a way to centre variable width block elements that doesn't depend on flexbox, which is:

    .centred {
        /* Make the element only as wide as it needs to be. */
        display: inline-block;
        /* Let us apply positioning. */
        position: relative;
        /* Move the left of the element to the middle of the container. */
        left: 50%;
        /* Translate backwards half the width of the block, thus centring it. */
        transform: translateX(-50%);
    }
It's a useful bit of CSS to have around.
Re:How to Center in CSS by crystalmace on Sunday May 15, 2016 @08:31PM (#11703493)
I use a similar trick all the time, especially for vertically centering elements. Also, mine usually includes the various vendor prefixes for the browsers.