bulma icon indicating copy to clipboard operation
bulma copied to clipboard

How to centered image?

Open koddr opened this issue 9 years ago • 12 comments

Hello and thanks for awesome Bulma project!

One little question: how to centered .image element? I try this:

<figure class="image is-text-centered">
  <img src="http://placehold.it/256x256">
</figure>

But it's not work.

P.S. I wish (in future) global element, like .is-centered, which make any elements to center aligned (on it's parent's container).

koddr avatar Dec 24 '16 09:12 koddr

How did you solve it?

anthonygore avatar Jun 15 '18 05:06 anthonygore

@anthonygore simply add this class:

.has-image-centered {
  margin-left: auto;
  margin-right: auto;
}

koddr avatar Jun 15 '18 16:06 koddr

Great, thank you. I thought there might have been a class in the library for it.

anthonygore avatar Jun 16 '18 05:06 anthonygore

@anthonygore it will be great, but.. @jgthms don't want to add this :(

koddr avatar Jun 16 '18 18:06 koddr

You can use the container class

<figure class="image container is-256x256">
    <img src="http://placehold.it/256x256">
</figure>

abdelba avatar Oct 18 '18 11:10 abdelba

You can use the container class

<figure class="image container is-256x256">
    <img src="http://placehold.it/256x256">
</figure>

Is this a side-effect of the container class? or is this an intended use case? Also, where did you get is-256x256?

dagumak avatar May 17 '19 01:05 dagumak

You can use the container class

<figure class="image container is-256x256">
    <img src="http://placehold.it/256x256">
</figure>

Is this a side-effect of the container class? or is this an intended use case? Also, where did you get is-256x256?

You can add 256 to the dimensions variable. $dimensions: 16 24 32 48 64 96 128 256;

husstahn avatar Jul 12 '19 05:07 husstahn

You can use the container class

<figure class="image container is-256x256">
    <img src="http://placehold.it/256x256">
</figure>

Is adding the container class supposed to work this way? How did you find out about this?

AlexTorianyk avatar Oct 14 '19 19:10 AlexTorianyk

None of the above works for me if this is not in the main viewport. I have to use

.parent {
    display: flex;
    justify-content: center;
    align-items: center;
}

in parent container.

crazyyi avatar Jun 21 '20 13:06 crazyyi

Wrap your image tag in a div.

<div class="is-text-centered">
  <img src="http://placehold.it/256x256">
</div>

p2436b avatar Feb 14 '21 04:02 p2436b

none of this worked for me

Knvgpt avatar May 12 '21 10:05 Knvgpt

You can try this

<div class="block has-text-centered">
  <figure class="image is-inline-block">
    <img src="http://placehold.it/256x256" />
  </figure>
</div>

moriak avatar Jun 17 '23 02:06 moriak