Bootstrap 3中心容器div

时间:2014-04-03 18:09:14

标签: asp.net twitter-bootstrap-3

我似乎无法找到将具有几个图像和标签的容器居中的方法。这是代码:

<div class="container">
   <div class="row">  
       <div class="col-sm-1" style="width:88px;padding-left:0px">
           <img id="Img1" runat="server" src="images/image1.gif" />
       </div>
       <div class="col-sm-8" style="height:60px">
           <div class="row">
               <div class="col-sm-12 BaseColor1" style="text-align:center">
                   <img id="Img2" runat="server" src="images/image2.gif" />
                </div>
            </div>
             <div class="row" style="background-color:white;color: black;text-align:center">
                  <div class="col-sm-12" style="vertical-align:central">
                       <asp:Label Runat="server" Height="26px" ID="lblComp">COMPANY</asp:Label>
                   </div>
              </div>
          </div>
      </div>
  </div>

如何制作整个容器div或&#34; row&#34; div(下面)以浏览器为中心?

1 个答案:

答案 0 :(得分:0)

尝试添加&#34;保证金:0自动&#34;

<div class="container" style="margin:0 auto">
   <div class="row">  
       <div class="col-sm-1" style="width:88px;padding-left:0px">
           <img id="Img1" runat="server" src="images/image1.gif" />
       </div>
       <div class="col-sm-8" style="height:60px">
           <div class="row">
               <div class="col-sm-12 BaseColor1" style="text-align:center">
                   <img id="Img2" runat="server" src="images/image2.gif" />
                </div>
            </div>
             <div class="row" style="background-color:white;color: black;text-align:center">
                  <div class="col-sm-12" style="vertical-align:central">
                       <asp:Label Runat="server" Height="26px" ID="lblComp">COMPANY</asp:Label>
                   </div>
              </div>
          </div>
      </div>
  </div>

您还可以看到this post关于使用Bootstrap&#34; offsets&#34;