2017-12-12 12 views
0

フレンドボックスのブートストラップ3で遊んでいる簡単な質問がありました。画面中央にイメージが中央に表示されているようです今、その中心ではなく、画面の上部にある:フレックスボックスセンターイメージが画面中央に表示されます

HTML:

<div class="parallaxb"> 
      <div class="homeimgbarber"> 
      <img class="img-responsive" src="img/cuts.png" style="margin: auto;"> 
       </div> 
    </div> 

CSS:.homeimgbarberは高さが適用される必要があるため、

.parallax { 
    background-image: url("../img/c.png"); 
    min-height: 1000px; 
    background-attachment: fixed; 
    background-position: center; 
    background-repeat: no-repeat; 
    background-size: cover; 
} 

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

答えて

1

それはあります。

.parallax { 
 
    background-image: url("http://via.placeholder.com/350x150"); 
 
    height: 1000px; 
 
    background-position: center; 
 
    background-repeat: no-repeat; 
 
    background-size: cover; 
 
} 
 

 
.homeimgbarber { 
 
    display: flex; 
 
    justify-content: center; 
 
    align-items: center; 
 
    height: 100vh; 
 
}
<div class="parallaxb"> 
 
      <div class="homeimgbarber"> 
 
      <img class="img-responsive" src="http://via.placeholder.com/350x150"> 
 
       </div> 
 
    </div>

+0

助け – RonTheOld

+0

いつでもパーフェクトに感謝​​!この答えを受け入れることを忘れないでください:)幸せなコーディング – jeh

関連する問題