Centre a table with CSS

Published on 2020-04-20 • Modified on 2020-04-20

In this snippet, we will see how to centre a table with CSS. That's the very first CSS snippet I put on this website. But why not? It's always good to improve other skills than your main ones. I give you the solution I choose. If you want to have more explanations, click on the "more on the web" link. I used this in my new side project Pomodoro.fun where even all elements where correctly aligned in the centre, the log table was the only one on the left. That's OK now with this little trick (click on the start/stop buttons).

    .center {
        margin: 10px auto;
    /* That's it! 😁 */

 More on Stackoverflow  More on the web  Random snippet

  Work with me!