How to centered image?
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).
How did you solve it?
@anthonygore simply add this class:
.has-image-centered {
margin-left: auto;
margin-right: auto;
}
Great, thank you. I thought there might have been a class in the library for it.
@anthonygore it will be great, but.. @jgthms don't want to add this :(
You can use the container class
<figure class="image container is-256x256">
<img src="http://placehold.it/256x256">
</figure>
You can use the
containerclass<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 use the
containerclass<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;
You can use the
containerclass<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?
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.
Wrap your image tag in a div.
<div class="is-text-centered">
<img src="http://placehold.it/256x256">
</div>
none of this worked for me
You can try this
<div class="block has-text-centered">
<figure class="image is-inline-block">
<img src="http://placehold.it/256x256" />
</figure>
</div>