2015-01-13 110 views
0

我正在處理頁腳,並且弄亂了某些位置並使其成爲了可以滾動到右側的屏幕上方的空白區域。我如何刪除它?這是我的代碼。Twitter-Bootstrap網站可以水平滾動

HTML

<head> 

    <meta charset="utf-8"> 
    <meta http-equiv="X-UA-Compatible" content="IE=edge"> 
    <meta name="viewport" content="width=device-width, initial-scale=1"> 
    <meta name="description" content=""> 
    <meta name="author" content=""> 

    <title>Ingraham PE</title> 

    <!-- Bootstrap Core CSS --> 
    <link href="css/bootstrap.min.css" rel="stylesheet"> 

    <!-- Custom CSS --> 
    <link href="css/main.css" rel="stylesheet"> 

    <!-- Custom Fonts --> 
    <link href="font-awesome-4.2.0/css/font-awesome.min.css" rel="stylesheet" type="text/css"> 
    <link href="http://fonts.googleapis.com/css?family=Lora:400,700,400italic,700italic" rel="stylesheet" type="text/css"> 
    <link href="http://fonts.googleapis.com/css?family=Montserrat:400,700" rel="stylesheet" type="text/css"> 

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> 
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> 
    <!--[if lt IE 9]> 
     <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script> 
     <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script> 
    <![endif]--> 

</head> 

<body id="about" data-spy="scroll" data-target=".navbar-fixed-top"> 

    <!-- Navigation --> 
    <nav class="navbar navbar-custom navbar-fixed-top" role="navigation"> 
     <div class="container"> 
      <div class="navbar-header"> 
       <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-main-collapse"> 
        <i class="fa fa-bars"></i> 
       </button> 
       <a class="navbar-brand" href="index.html"> 
        <span class="light">Home</span> 
       </a> 
      </div> 

      <!-- Collect the nav links, forms, and other content for toggling --> 
      <div class="collapse navbar-collapse navbar-right navbar-main-collapse"> 
       <ul class="nav navbar-nav"> 
        <!-- Hidden li included to remove active class from about link when scrolled up past about section --> 
        <li class="hidden"> 
         <a href="#page-top"></a> 
        </li> 
        <li class="active"> 
         <a href="about.html">About</a> 
        </li> 
        <li> 
         <a href="contact.html">Contact</a> 
        </li> 
        <li class="dropdown"> 
         <a href="assignments.html" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Assignments <span class="caret"></span></a> 
         <ul class="dropdown-menu" role="menu"> 
          <li><a href="wt.index">Weight Training</a></li> 
          <li><a href="pf.index">Personal Fitness</a></li> 
          <li><a href="la.index">Lifetime Activities</a></li> 
          <li><a href="ts.index">Team Sports</a></li> 
         </ul> 
        </li> 
        <li> 
         <a href="elvig.html">Mr.Elvig</a> 
        </li> 
       </ul> 
      </div> 
      <!-- /.navbar-collapse --> 
     </div> 
     <!-- /.container --> 
    </nav> 

    <header class="intro"> 
     <div class="intro-body"> 
      <div class="container"> 
       <div class="row"> 
        <div class="col-md-8 col-md-offset-2"> 
         <h1 class="brand-heading">About</h1> 
         <a href="#main" class="page-scroll"><img src="img/arrow-down.png"></a> 
        </div> 
       </div> 
      </div> 
     </div> 
    </header> 

    <span class="anchor" id="main"></span> 
    <div class="content"> 
     <div class="row"> 
      <div class="col-md-3 col-md-offset-2 ing"><img src="img/Ingraham.png"></div> 
      <div class="col-md-6"><p class="content-text">「Intelligence and skill can only function at the peak of their capacity when the body is healthy and strong.」 John F. Kennedy <br/><br/>Exercise can help prevent excess weight gain or help maintain weight loss. When you engage in physical activity, you burn calories. The more intense the activity, the more calories you burn. You don't need to set aside large chunks of time for exercise to reap weight-loss benefits. If you can't do an actual workout, get more active throughout the day in simple ways — by taking the stairs instead of the elevator or revving up your household chores.</p></div> 
     </div> 
    </div> 

    <footer class="footer"> 
     <div class='row'> 

     </div> 
    </footer> 

    <!-- jQuery --> 
    <script src="js/jquery.js"></script> 

    <!-- Bootstrap Core JavaScript --> 
    <script src="js/bootstrap.min.js"></script> 

    <!-- Plugin JavaScript --> 
    <script src="js/jquery.easing.min.js"></script> 

    <!-- Google Maps API Key - Use your own API key to enable the map feature. More information on the Google Maps API can be found at https://developers.google.com/maps/ --> 
    <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCRngKslUGJTlibkQ3FkfTxj3Xss1UlZDA&sensor=false"></script> 

    <!-- Custom Theme JavaScript --> 
    <script src="js/main.js"></script> 

</body> 

</html> 

CSS

body { 
    width: 100%; 
    height: 100%; 
    font-family: Lora,"Helvetica Neue",Helvetica,Arial,sans-serif; 
    color: #fff; 
    background-color: #000; 
} 

html { 
    width: 100%; 
    height: 100%; 
} 

h1, 
h2, 
h3, 
h4, 
h5, 
h6 { 
    margin: 0 0 35px; 
    text-transform: uppercase; 
    font-family: Montserrat,"Helvetica Neue",Helvetica,Arial,sans-serif; 
    font-weight: 700; 
    letter-spacing: 1px; 
} 

p { 
    margin: 0 0 25px; 
    font-size: 18px; 
    line-height: 1.5; 
} 

@media(min-width:767px) { 
    p { 
     margin: 0 0 35px; 
     font-size: 20px; 
     line-height: 1.6; 
    } 
} 

a { 
    color: #219ab3; 
    -webkit-transition: all .2s ease-in-out; 
    -moz-transition: all .2s ease-in-out; 
    transition: all .2s ease-in-out; 
} 

a:hover, 
a:focus { 
    text-decoration: none; 
    color: #11505d; 
} 

.light { 
    font-weight: 400; 
} 

.navbar-custom { 
    margin-bottom: 0; 
    border-bottom: 1px solid rgba(255,255,255,.3); 
    text-transform: uppercase; 
    font-family: Montserrat,"Helvetica Neue",Helvetica,Arial,sans-serif; 
    background-color: #000; 
} 

.navbar-custom .navbar-brand { 
    font-weight: 700; 
} 

.navbar-custom .navbar-brand:focus { 
    outline: 0; 
} 

.navbar-custom .navbar-brand .navbar-toggle { 
    padding: 4px 6px; 
    font-size: 16px; 
    color: #fff; 
} 

.navbar-custom .navbar-brand .navbar-toggle:focus, 
.navbar-custom .navbar-brand .navbar-toggle:active { 
    outline: 0; 
} 

.navbar-custom a { 
    color: #fff; 
} 

.navbar-custom .nav li.active { 
    outline: nonte; 
    background-color: rgba(255,255,255,.3); 
} 

.navbar-custom .nav li a { 
    -webkit-transition: background .3s ease-in-out; 
    -moz-transition: background .3s ease-in-out; 
    transition: background .3s ease-in-out; 
} 

.navbar-custom .nav li a:hover, 
.navbar-custom .nav li a:focus { 
    outline: 0; 
    background-color: rgba(255,255,255,.3); 
} 

@media(min-width:767px) { 
    .navbar { 
     padding: 20px 0; 
     border-bottom: 0; 
     letter-spacing: 1px; 
     background: 0 0; 
     -webkit-transition: background .5s ease-in-out,padding .5s ease-in-out; 
     -moz-transition: background .5s ease-in-out,padding .5s ease-in-out; 
     transition: background .5s ease-in-out,padding .5s ease-in-out; 
    } 

    .top-nav-collapse { 
     padding: 0; 
     background-color: #000; 
    } 

    .navbar-custom.top-nav-collapse { 
     border-bottom: 1px solid rgba(255,255,255,.3); 
    } 
} 

.intro { 
    display: table; 
    width: 100%; 
    height: auto; 
    padding: 100px 0; 
    text-align: center; 
    color: #fff; 
    background: url(../img/intro-bg.jpg) no-repeat bottom center fixed; 
    background-color: #000; 
    -webkit-background-size: cover; 
    -moz-background-size: cover; 
    background-size: cover; 
    -o-background-size: cover; 
} 

.intro .intro-body { 
    display: table-cell; 
    vertical-align: middle; 
} 

.intro .intro-body .brand-heading { 
    font-size: 40px; 
} 

.intro .intro-body .intro-text { 
    font-size: 18px; 
} 

@media(min-width:767px) { 
    .intro { 
     height: 100%; 
     padding: 0; 
    } 

    .intro .intro-body .brand-heading { 
     font-size: 80px; 
    } 

    .intro .intro-body .intro-text { 
     font-size: 20px; 
    } 
} 

@-webkit-keyframes pulse {  
    0 { 
     -webkit-transform: scale(1); 
     transform: scale(1); 
    } 

    50% { 
     -webkit-transform: scale(1.2); 
     transform: scale(1.2); 
    } 

    100% { 
     -webkit-transform: scale(1); 
     transform: scale(1); 
    } 
} 

@-moz-keyframes pulse {  
    0 { 
     -moz-transform: scale(1); 
     transform: scale(1); 
    } 

    50% { 
     -moz-transform: scale(1.2); 
     transform: scale(1.2); 
    } 

    100% { 
     -moz-transform: scale(1); 
     transform: scale(1); 
    } 
} 

::-moz-selection { 
    text-shadow: none; 
    background: #fcfcfc; 
    background: rgba(255,255,255,.2); 
} 

::selection { 
    text-shadow: none; 
    background: #fcfcfc; 
    background: rgba(255,255,255,.2); 
} 

img::selection { 
    background: 0 0; 
} 

img::-moz-selection { 
    background: 0 0; 
} 

body { 
    webkit-tap-highlight-color: rgba(255,255,255,.2); 
} 

.content { 
    margin: 150px 0px 150px 0px; 
    background-color: white; 
    color: black; 

} 

p.content-text { 
    margin: 0px 10px 0px 10px; 
} 

#about { 
    background: url(../img/intro-bg.jpg) no-repeat; 
} 
.ing { 
    margin-top: 55px; 
} 

.anchor{ 
    display: block; 
    height: 51px; /*same height as header*/ 
    margin-top: -51px; /*same height as header*/ 
    visibility: hidden; 
} 

.footer { 
    height: 50px; 
    background-color: grey; 
} 

在此先感謝,伊恩。

回答

3

將容器類添加到內容div。在bootstrap中,行需要位於容器類中。

<div class="content container"> <-- add container class here 
    <div class="row"> 
     <div class="col-md-3 col-md-offset-2 ing"><img src="img/Ingraham.png"></div> 
     <div class="col-md-6"><p class="content-text">....</p></div> 
    </div> 
</div> 

編輯:

剛纔檢查再次內容類是搞亂容器邊距,以便更好地做這樣的。

<div class="content"> 
    <div class="container"><-- add container class here 
     <div class="row"> 
      <div class="col-md-3 col-md-offset-2 ing"><img src="img/Ingraham.png"></div> 
      <div class="col-md-6"><p class="content-text">....</p></div> 
     </div> 
    </div> 
</div> 
+0

參見https://github.com/twbs/bootlint/wiki/E003 – cvrebert