stylesheet

img-responsiveの中央寄せ

img-responsiveを利用した画像を真ん中に表示したい場合にどうやってやるのかよくわからなかったけど、

class="img-responsive center-block"
これで解決するメモ

Images in Bootstrap 3 can be made responsive-friendly via the addition of the .img-responsive class. This applies max-width: 100%;, height: auto; and display: block; to the image so that it scales nicely to the parent element.

To center images which use the .img-responsive class, use .center-block instead of .text-center. See the helper classes section for more details about .center-block usage.
参考:twitter bootstrapの公式サイトより

英語が理解できないせいでずっとやり方がわからなかったけどちゃんと書いてあったわ…。

center-block

.center-block {
    display: block;
    margin-right: auto;
    margin-left: auto;
}
  • この記事を書いた人

ゆず

忘れないように自分の覚書と、誰かも困っているかもしれないので参考になればいいなくらいの軽い備忘録です。
一杯おごる

-stylesheet
-