2015-10-13 112 views
0

我使用Bootstrap推拉不能正常工作! 移動視圖工作正常但是Web視圖轉移到左 幫助將不勝感激Bootstrap推拉不能正常工作

這裏工作不正常我的代碼----

<!DOCTYPE html> 

<html xmlns="http://www.w3.org/1999/xhtml"> 
<head runat="server"> 
<title></title> 
<meta charset="utf-8" /> 
<meta name="viewport" content="width=device-width, initial-scale=1" /> 
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" /> 
<link href="Style/StyleSheet.css" rel="stylesheet" /> 
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script> 
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> 
</head> 
<body> 
<form id="form1" runat="server"> 
    <div class="Header"> 
     <div class="container"> 
      <div class="row"> 
       <div class="col-lg-2 HeadLeft"> 
        STATUS 99 
       </div> 
       <div class="col-lg-8"> 
       </div> 
       <div class="col-lg-2 HeadRight"> 
        <ul class="list-inline"> 
         <li><a href="#">Home</a></li> 
         <li><a href="#">FB Scrap</a></li> 
         <li><a href="#">SMS</a></li> 
        </ul> 
       </div> 
      </div> 
     </div> 
    </div> 

    <div class="container"> 
     <div class="row"> 
      <div class="col-lg-2 col-lg-pull-2 LeftMenu"> 
       <h4>FB Status Categories</h4> 
       <div class="sidebar-nav"> 
        <div class="navbar navbar-default" role="navigation"> 
         <div class="navbar-header"> 
          <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".sidebar-navbar-collapse"> 
           <span class="sr-only">Toggle navigation</span> 
           <span class="icon-bar"></span> 
           <span class="icon-bar"></span> 
           <span class="icon-bar"></span> 
          </button> 
          <span class="visible-xs navbar-brand">Sidebar menu</span> 
         </div> 
         <div class="navbar-collapse collapse sidebar-navbar-collapse"> 
          <ul class="nav navbar-nav"> 
           <li class="active"><a href="#">Menu Item 1</a></li> 
           <li><a href="#">Menu Item 2</a></li> 
           <li><a href="#">Menu Item 3</a></li> 
           <li><a href="#">Menu Item 4</a></li> 
           <li><a href="#">Reviews <span class="badge">1,118</span></a></li> 
          </ul> 
         </div> 
         <!--/.nav-collapse --> 
        </div> 
       </div> 
      </div> 
      <div class="col-lg-2 col-lg-push-2 RightMenu"> 
       <h4>FB Cover pictures</h4> 
       <ul class="list-unstyled"> 
        <li>Funny Status</li> 
        <li>Funny Status</li> 
        <li>Funny Status</li> 
        <li>Funny Status</li> 
        <li>Funny Status</li> 
        <li>Funny Status</li> 
        <li>Funny Status</li> 
        <li>Funny Status</li> 
        <li>Funny Status</li> 
        <li>Funny Status</li> 
        <li>Funny Status</li> 
        <li>Funny Status</li> 
        <li>Funny Status</li> 
        <li>Funny Status</li> 
        <li>Funny Status</li> 
        <li>Funny Status</li> 
        <li>Funny Status</li> 
        <li>Funny Status</li> 
        <li>Funny Status</li> 
        <li>Funny Status</li> 
        <li>Funny Status</li> 
        <li>Funny Status</li> 
        <li>Funny Status</li> 
        <li>Funny Status</li> 
        <li>Funny Status</li> 
        <li>Funny Status</li> 
        <li>Funny Status</li> 
        <li>Funny Status</li> 
        <li>Funny Status</li> 
        <li>Funny Status</li> 
        <li>Funny Status</li> 
        <li>Funny Status</li> 
       </ul> 
      </div> 
      <div class="col-lg-8 col-lg-pull-8"> 
       <h1>Main Content</h1> 
      </div> 

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

CSS IM使用

body { 
font-family:Tahoma; 
} 

.Header{ 
background-color:rgb(59,89,152); 
min-height:3em; 
color:white; 
} 

.HeadLeft{ 
font-family:'Times New Roman'; 
font-size:2.2em; 
padding:0.1em; 
} 

.HeadRight{ 
font-family:Tahoma; 
font-size:1.25em; 
padding:0.1em; 

} 

.HeadRight a{ 
text-decoration:none; 
color:rgb(255,255, 255);  
} 

.LeftMenu{ 
box-shadow: 0 0.6250em 0.3125em #888888; 
} 

.LeftMenu h4{ 
background-color:rgb(240, 240, 240); 
/*padding:0.1em 0;*/ 
} 

.RightMenu{ 
box-shadow: 0 0.6250em 0.3125em #888888; 
} 

.RightMenu h4{ 
background-color:rgb(240, 240, 240); 
/*padding:0.1em 0;*/ 
} 

ul li{ 
/*padding:0.2em;*/ 
} 

/* make sidebar nav vertical */ 
@media (min-width: 768px) { 
.sidebar-nav .navbar .navbar-collapse { 
padding: 0; 
max-height: none; 
} 
.sidebar-nav .navbar ul { 
float: none; 
display: block; 
} 
.sidebar-nav .navbar li { 
float: none; 
display: block; 
} 
.sidebar-nav .navbar li a { 
padding-top: 12px; 
padding-bottom: 12px; 
} 
} 

回答

1

你應該改變你的HTML結構是這樣,

<form id="form1" runat="server"> 
     <div class="Header"> 
      <div class="container"> 
       <div class="row"> 
        <div class="col-lg-2 HeadLeft"> 
         STATUS 99 
        </div> 
        <div class="col-lg-8"> 
        </div> 
        <div class="col-lg-2 HeadRight"> 
         <ul class="list-inline"> 
          <li><a href="#">Home</a></li> 
          <li><a href="#">FB Scrap</a></li> 
          <li><a href="#">SMS</a></li> 
         </ul> 
        </div> 
       </div> 
      </div> 
     </div> 

     <div class="container"> 
      <div class="row"> 
       <div class="col-lg-2 LeftMenu"> 
        <h4>FB Status Categories</h4> 
        <div class="sidebar-nav"> 
         <div class="navbar navbar-default" role="navigation"> 
          <div class="navbar-header"> 
           <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".sidebar-navbar-collapse"> 
            <span class="sr-only">Toggle navigation</span> 
            <span class="icon-bar"></span> 
            <span class="icon-bar"></span> 
            <span class="icon-bar"></span> 
           </button> 
           <span class="visible-xs navbar-brand">Sidebar menu</span> 
          </div> 
          <div class="navbar-collapse collapse sidebar-navbar-collapse"> 
           <ul class="nav navbar-nav"> 
            <li class="active"><a href="#">Menu Item 1</a></li> 
            <li><a href="#">Menu Item 2</a></li> 
            <li><a href="#">Menu Item 3</a></li> 
            <li><a href="#">Menu Item 4</a></li> 
            <li><a href="#">Reviews <span class="badge">1,118</span></a></li> 
           </ul> 
          </div> 
          <!--/.nav-collapse --> 
         </div> 
        </div> 
       </div> 
       <div class="col-lg-2 col-lg-push-8 RightMenu"> 
        <h4>FB Cover pictures</h4> 
        <ul class="list-unstyled"> 
         <li>Funny Status</li> 
         <li>Funny Status</li> 
         <li>Funny Status</li> 
         <li>Funny Status</li> 
         <li>Funny Status</li> 
         <li>Funny Status</li> 
         <li>Funny Status</li> 
         <li>Funny Status</li> 
         <li>Funny Status</li> 
         <li>Funny Status</li> 
         <li>Funny Status</li> 
         <li>Funny Status</li> 
         <li>Funny Status</li> 
         <li>Funny Status</li> 
         <li>Funny Status</li> 
         <li>Funny Status</li> 
         <li>Funny Status</li> 
         <li>Funny Status</li> 
         <li>Funny Status</li> 
         <li>Funny Status</li> 
         <li>Funny Status</li> 
         <li>Funny Status</li> 
         <li>Funny Status</li> 
         <li>Funny Status</li> 
         <li>Funny Status</li> 
         <li>Funny Status</li> 
         <li>Funny Status</li> 
         <li>Funny Status</li> 
         <li>Funny Status</li> 
         <li>Funny Status</li> 
         <li>Funny Status</li> 
         <li>Funny Status</li> 
        </ul> 
       </div> 
       <div class="col-lg-8 col-lg-pull-2"> 
        <h1>Main Content</h1> 
       </div> 

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

的事情是引導col-類總是來自左邊。所以左邊的菜單隻需要col-lg-2,它將佔用2個引導列的寬度。然後你必須給你的右菜單寬度,所以你給col-md-2它。然後你必須使用col-push將它推到右側。 Bootstrap具有12列布局。所以你可以給col-lg-8的主要內容。然後,您必須將其拉回2列,因爲它將根據我們的HTML結構在RightMenu之後開始渲染

1

Th是應該工作:

<div class="row"> 
    <div class="col-lg-2 LeftMenu"> 
     ... 
    </div> 
    <div class="col-lg-2 col-lg-push-8 RightMenu"> 
     ... 
    </div> 
    <div class="col-lg-8 col-lg-pull-2"> 
     ... 
    </div> 
</div> 

您使用推/拉的邏輯只是有點關閉。您需要將第二列的八列寬度向右推(爲八列寬度列騰出空間)。然後您需要將第三列的兩列寬度向左拉(爲兩列寬度騰出空間.RightMenu列)。您應該再次閱讀BootStrap文檔。推/拉相對於列通常呈現的位置發生。第一次包裹頭部有點棘手。