Ionic: How to center a div?

You already found your answer but I would do something like that instead:

In your css:

.center {
    margin-left: auto;
    margin-right: auto;
    display: block;
}

And then just add this class to your image:

 <img src="https://stackoverflow.com/questions/31050832/{{ data.logo }}" class="center" alt="">

This way you don’t need to adjust each image on its own and I find this very descriptive when you look at the HTML. Also, it is not restricted to a specific image size.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)