2016-05-04 9 views
0

イメージとテキストは中央にある必要があります。テキストは中央に移動しますが、イメージはテキストの上部に表示されます。同じ方法でテキストと画像が必要ですが、中心にしかありません。おかげ以下は事前にイメージとテキストの両方を同じ形で中央に保存する解決策が必要です

.

は私のコードです:

<nav class="navbar navbar-default navbar-fixed-top"> 
 
    <div class="container-fluid"> 
 
    <!-- Brand and toggle get grouped for better mobile display --> 
 

 

 
    <div class='col-md-12-fluid' style=" 
 
    \t 
 
     padding-bottom: 2px; 
 
     background-color:#7E8F7C; 
 
     
 
     "> 
 
     <div class "row" style="background-color:red !important"> 
 
     <div class='col-md-8-fluid'> 
 
      <!--recently search was here--> 
 
      <a class="navbar-brand" href="index.html"></a> 
 
     </div> 
 
     <div class='col-md-4-fluid' style="background-color:#3B3738; height:25px;"> 
 
      <h3>Nepal Safety</h3> 
 
     </div> 
 
     </div> 
 

 

 
     <div class="row"> 
 
     <div class='col-md-8-fluid'> 
 
      <!--recently search was here--> 
 
      <a class="navbar-brand" href="index.html"> 
 
      <img src="images/iccn.png" height="50px" width="100px"> 
 
      </a> 
 
     </div> 
 
     <br> 
 
     <div class='col-md-4-fluid'> 
 
      <h3>Nepal Safety</h3> 
 
     </div> 
 
     </div> 
 
    </div> 
 

 
    <div class='clearfix'></div> 
 
    <div class="navbar-header">

+0

クルセイダー、[js​​fiddle-例]を作成します(https://jsfiddle.net/)問題行動と –

答えて

2

ここでは、次のとおりです。

<nav class="navbar navbar-default navbar-fixed-top"> 
 
    <div class="container-fluid"> 
 
    <!-- Brand and toggle get grouped for better mobile display --> 
 

 

 
    <div class='col-md-12-fluid' style="padding-bottom: 2px; background-color:#7E8F7C; min-height: 500px;"> 
 
     <div class="row" style="background-color:red !important"> 
 
     <div class='col-md-8-fluid'> 
 
      <!--recently search was here--> 
 
      <a class="navbar-brand" href="index.html"></a> 
 
     </div> 
 
     <div class='col-md-4-fluid' style="background-color:#3B3738; height:25px;"> 
 
      <h3>Nepal Safety</h3> 
 
     </div> 
 
     </div> 
 

 

 
     <div class="row" style="clear: both"> 
 
     <div class='col-md-8-fluid' style="width: 500px; margin: 0 auto; background: blue"> 
 
      <!--recently search was here--> 
 
      <a class="navbar-brand" href="index.html" style="float: left"> 
 
      <img src="images/iccn.png" height="50px" width="100px"> 
 
      </a> 
 
      
 
      <h3>Nepal Safety</h3> 
 
     </div> 
 
     </div> 
 
    </div> 
 

 
    <div class='clearfix'></div> 
 
    <div class="navbar-header">

+0

画像は中央に画像のちょうど右である必要があり、テキストとテキストの左側に表示されなければなりません。ここでは既に画像が上に表示されます。 #ThankYou – Crusader

+0

私はあなただけ 'マージン、あなたのコンテナの幅を設定する必要があり、コードを編集した:0自動;'ブロックを中心に説明します。ところで、画像とタイトルは同じdivになければなりません –

0

これは動作するはずです:

 <nav class="navbar navbar-default navbar-fixed-top"> 
    <div class="container-fluid"> 
    <!-- Brand and toggle get grouped for better mobile display --> 


    <div class='col-md-12-fluid' style=" 

     padding-bottom: 2px; 
     background-color:#7E8F7C; 

     "> 
     <div class="row" style="background-color:red !important"> 
     <div class='col-md-8-fluid'> 
      <!--recently search was here--> 
      <a class="navbar-brand" href="index.html"></a> 
     </div> 
     <div class='col-md-4-fluid' style="background-color:#3B3738; height:25px;"> 
      <h3>Nepal Safety</h3> 
     </div> 
     </div> 


     <div class="row"> 
     <div class='col-md-6'> 
      <!--recently search was here--> 
      <a class="navbar-brand" href="index.html" style="float:right;"> 
      <img src="images/iccn.png" height="50px" width="100px"> 
      </a> 
     </div> 
     <br> 
     <div class='col-md-6'> 
      <h3>Nepal Safety</h3> 
     </div> 
     </div> 
    </div> 

    <div class='clearfix'></div> 
    <div class="navbar-header"> 

を、私はそれらの各画面の半分の幅を作り、6,6ように列を変更しました。私は列のクラスから "流体"を削除しました(あなたは流体に包囲されたdivを持っているので、その流体は必要ありません)。最後に、ヘッダーの横に座るようにイメージを右に浮かべました。

それはあなたが探していたものだ場合を教えてください!

関連する問題