2017-10-05 54 views
0

我試圖將屏幕尺寸變小時我的按鈕對齊到移動屏幕的中心,嘗試將文本對齊設置爲居中,但似乎不起作用。對齊按鈕中心小屏幕引導程序

它必須是拉左/文本正確的引導程序類即時消息試圖重寫,只是不太確定我缺少的東西。

CSS:

@media screen and (max-width: 998px) { 

    @font-face{ 
     font-family: 'Gotham'; 
     src: url("assets/fonts/Gotham-Bold.otf"); 
     src: url("assets/fonts/Gotham-Light.otf"); 
    } 

    @font-face { 
    font-family: "Gotham-Bold"; 
    src: url("assets/fonts/Gotham-Bold.otf"); 
    font-weight: Bold; 
    } 

    @font-face { 
    font-family: "Gotham-Light"; 
    src: url("assets/fonts/Gotham-Light.otf"); 
    font-weight: Light; 
    } 

    .col-md-4.pull-left.text-right{ 
     position: relative; 
     text-align: center; 
    } 
. 
. 
. 

HTML:

<div class="container-fluid"> 
    <div class="row"> 
      <div class="col-sm-8 pull-right text-left" > 
       <div class="IMGpadding"></div><br> 
       <img style="float:left" class="img-responsive" src = "assets/images/white-leaf-bg.jpg" id="frame"/> 
      </div> 
      <div class="col-md-4 pull-left text-right" > 
       <div class="h1padding"></div> 
       <a style="float:right" class = "h1" href="" id="introID"><b>INTRO</b></a> 

       <div class="h1padding"></div> 
       <a style="float:right" class = "h1" href="" id="OnSuerfaceID"><b>ON THE</b> <span class="light">SURFACE</span></a> 

       <div class="h1padding"></div> 
       <a style="float:right" href="" id="FromOilID"><b>FROM</b> <span class="light">ORE TO OIL</span></a> 

       <div class="h1padding"></div> 
       <a style="float:right" href="" id="EnvImpactID"><b>ENVIRONMENTAL</b> <span class="light">CARE</span></a> 

       <div class="h1padding"></div> 
       <a style="float:right" class = "h1" href="" id="MoreThanGasID"><b>MUCH MORE THAN</b> <span class="light">GASOLINE</span></a> 

       <div class="h1padding"></div> 
       <a style="float:right" class = "h1" href="" id="OneMoreID"><b>ONE MORE</b> <span class="light">THING</span></a> 

      </div> 
    </div> 
</div> 

Current look

在此先感謝,我仍然在引導非常一個小白。

+0

可能重複[如何在Twitter Bootstrap 3中按鈕]?(https://stackoverflow.com/questions/22578853/how-to-center-buttons-in-twitter-bootstrap-3) –

+1

您需要刪除所有元素中的float:right –

回答

1

這取決於你的其他網頁以及。根據您的要求和代碼添加在這裏,我已經在codepen中添加了一個工作副本。試試這個: enter image description here

@media screen and (max-width: 998px) { 
 

 
    @font-face{ 
 
     font-family: 'Gotham'; 
 
     src: url("assets/fonts/Gotham-Bold.otf"); 
 
     src: url("assets/fonts/Gotham-Light.otf"); 
 
    } 
 

 
    @font-face { 
 
    font-family: "Gotham-Bold"; 
 
    src: url("assets/fonts/Gotham-Bold.otf"); 
 
    font-weight: Bold; 
 
    } 
 

 
    @font-face { 
 
    font-family: "Gotham-Light"; 
 
    src: url("assets/fonts/Gotham-Light.otf"); 
 
    font-weight: Light; 
 
    } 
 

 
    .col-sm-4.pull-left.text-right{ 
 
     position: relative; 
 
     text-align: right; 
 
     width:50%; 
 
     text-align:right; 
 
    } 
 
    .h1padding { 
 
    margin-bottom:100px; 
 
    } 
 
} 
 
<div class="container-fluid"> 
 
    <div class="row"> 
 
      <div class="col-sm-8 pull-right text-left" > 
 
       <div class="IMGpadding"></div><br> 
 
       <img style="float:left" class="img-responsive" src = "assets/images/white-leaf-bg.jpg" id="frame"/> 
 
      </div> 
 
      <div class="col-sm-4 pull-left text-right" > 
 
       <div class="h1padding"></div> 
 
       <a class = "h1" href="" id="introID"><b>INTRO</b></a> 
 

 
       <div class="h1padding"></div> 
 
       <a class = "h1" href="" id="OnSuerfaceID"><b>ON THE</b> <span class="light">SURFACE</span></a> 
 

 
       <div class="h1padding"></div> 
 
       <a href="" id="FromOilID"><b>FROM</b> <span class="light">ORE TO OIL</span></a> 
 

 
       <div class="h1padding"></div> 
 
       <a href="" id="EnvImpactID"><b>ENVIRONMENTAL</b> <span class="light">CARE</span></a> 
 

 
       <div class="h1padding"></div> 
 
       <a class = "h1" href="" id="MoreThanGasID"><b>MUCH MORE THAN</b> <span class="light">GASOLINE</span></a> 
 

 
       <div class="h1padding"></div> 
 
       <a class = "h1" href="" id="OneMoreID"><b>ONE MORE</b> <span class="light">THING</span></a> 
 

 
      </div> 
 
    </div> 
 
</div>

codepen link