2017-10-05 63 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