在移动浏览器中查看时按钮丢失(Bootstrap)

时间:2015-12-17 18:37:50

标签: html twitter-bootstrap

我制作了一个网页 - Campus Connect - Colleges。但是,在移动设备上查看此功能会隐藏组的按钮。而且,按钮不会显示居中。

整个页面代码是 -

<!DOCTYPE html>
<html lang="en" hola_ext_inject="disabled">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
  <meta name="description" content="">
  <meta name="author" content="">
  <link rel="icon" href="http://getbootstrap.com/favicon.ico">
  <link rel="stylesheet" type="text/css" href="fonts/glyphicons-halflings-regular.eot">
  <title>Campus Connect</title>
  <!-- Bootstrap core CSS -->
  <link href="css/bootstrap.css" rel="stylesheet">
  <style type="text/css">
     .colorb:hover{
     background-color: #F5D357 !important;
     }
     .colorb:active{
     background-color: #F5D357 !important;
     }
  </style>
  <!-- Custom styles for this template -->
  <link href="css/sticky-footer-navbar.css" rel="stylesheet">
  <!-- Just for debugging purposes. Don't actually copy these 2 lines! -->
  <!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
  <script src="js/ie-emulation-modes-warning.js"></script>
  <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
  <!--[if lt IE 9]>
  <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
  <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
  <![endif]-->
</head>
   <body style="background-image:url('images/bkg.jpg');background-size:cover;background-repeat:no-repeat;">
  <!-- Fixed navbar -->
  <nav class="navbar navbar-default navbar-fixed-top" style="background-color:#383838;border:0;">
     <div class="container">
        <div class="navbar-header">
           <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
           <span class="sr-only">Toggle navigation</span>
           <span class="icon-bar"></span>
           <span class="icon-bar"></span>
           <span class="icon-bar"></span>
           </button>
           <div class="navbar-brand" style="padding:0;"><img src="images/logo.png" style="width:200px;height:100%;" onClick="document.location.href='app_index.html';"></div>
        </div>
        <div id="navbar" class="collapse navbar-collapse">
           <!--   <ul class="nav navbar-nav">
              <li class="active"><a href="index.html">Home</a></li>
              <li><a href="#about">About</a></li>
              <li><a href="#contact">Contact</a></li>
              </ul> -->
           <ul class="nav navbar-nav navbar-right">
              <li><a target="_blank" href="https://play.google.com/store/apps/details?id=com.campusconnect" style="color:#EBD07B;">Get the App</a></li>
              <li><img src="images/android.png" class="img-responsive img-circle" alt="App" style="width:40px;height:40px;text-align:center;margin-top:5px;padding-top:5px;padding-bottom:5px;border: 2px solid #EBD07B;border-radius: 25px;"></li>
           </ul>
        </div>
        <!--/.nav-collapse -->
     </div>
  </nav>
  <!-- Begin page content -->
  <div class="container">
     <div class="page-header">
        <h2 id="coll_name" style="text-align:center;"></h2>
     </div>
     <div class="row">
        <div class="col-md-3 col-md-offset-1">
           <div style="text-align:center;">
              <span aria-hidden="true" style="font-size:50px;"><img src = "calendar.png"/></span>
           </div>
           <br/>
           <div style="font-size:20px;">
              <p style="text-align:center;" id="event_no"></p>
              <p style="text-align:center;">Events Happening Today</p>
           </div>
           <button type="button" class="btn btn-info colorb" style="margin-left:30%;background-color:transparent;border-color:black;color:black;" onclick="location.href='calendar.html';"> Calendar</button>
        </div>
        <div class="col-md-3 col-md-offset-3">
           <div style="text-align:center;">
              <span aria-hidden="true" style="font-size:50px;"><img src = "groups.png"/></span>
           </div>
           <br/>
           <div style="font-size:20px;">
              <p id="group_no" style="text-align:center;"></p>
              <p style="text-align:center;">Groups On Campus</p>
           </div>
           <button type="button" class="btn btn-success colorb" style="margin-left:30%;background-color:transparent;border-color:black;color:black;" onclick="location.href='groups.html';">Explore Groups</button></a>
        </div>
     </div>
  </div>
  <footer class="footer" style="background-color:#383838;height:100px">
     <div class="container">
        <div class="row" style="text-align:center;">
           <img src="images/facebook_circle.png" style="width:40px;height:40px;margin-top:2px;">
        </div>
        <div class="row" style="text-align:center;color:white;">
           <p>Copyright 2015 Campus Connect</p>
        </div>
        <div class="row" style="text-align:center;color:white;">
           <p>Made with <img src="images/heart.png" style="height:20px;"> in Bangalore</p>
        </div>
     </div>
  </footer>
  <!-- Bootstrap core JavaScript
     ================================================== -->
  <!-- Placed at the end of the document so the pages load faster -->
  <script src="js/jquery.min.js"></script>
  <script src="js/bootstrap.min.js"></script>
  <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
  <script src="js/ie10-viewport-bug-workaround.js"></script>
  <script type="text/javascript">
     function init(){
       gapi.client.load('xxxx', 'v1',loaded, 'xxxxx');
     }
     function loaded(){
       var col_name = localStorage.getItem('CollegeName');
       var col_id = localStorage.getItem('CollegeId');
       document.getElementById('coll_name').innerHTML = col_name;
       gapi.client.clubs.getClubList({'college_id':col_id}).execute(function(resp) {
                   console.log("Here and there");
                   console.log(resp.result.list.length);
                   console.log("Done here");
                    document.getElementById('group_no').innerHTML= resp.result.list.length;
              });
       now_date = getDate();
       gapi.client.clubs.collegeFeed({'collegeId':col_id,'date':now_date}).execute(function(resp){
         console.log('Success');
          console.log(resp);
          var flag;
          if (resp.result.length === undefined)
          {
           flag = 0;
          }
          else
          {
             flag = resp.result.length;
          }
           document.getElementById('event_no').innerHTML=flag;
         });
       function getDate()
       {
         var today = new Date();
         var dd = today.getDate();
         var mm = today.getMonth()+1; //January is 0!
         var yyyy = today.getFullYear();
       today = yyyy+'-'+mm+'-'+dd;
       //final_date = '"'+today+'"';
       console.log(today);
       return today;
       }
     }
  </script>
  <script src="https://apis.google.com/js/client.js?onload=init"></script>
</body>
</html>

错误是什么?我该如何解决这个问题?

2 个答案:

答案 0 :(得分:1)

你的粘性页脚是罪魁祸首。在sticky-footer-navbar.css第25行中,添加第三个填充值为100px可以解决问题:

body > .container {
    padding: 60px 15px 100px;
}

如果我是你,我也会摆脱内联造型。您已在所有段落上添加了文本对齐样式,而不是在样式表中定义规则。此外,您可以使按钮位于成像下方的中心位置:

style: block;
margin: 0 auto;

答案 1 :(得分:0)

  • 从按钮的内嵌样式中删除margin-left=30%
  • text-align: center添加到 包装元素。