如何在移动视图中删除水平滚动条?

时间:2016-04-27 16:47:26

标签: html css

在bootstrap3中我试图删除移动中的水平滚动条它在桌面视图中看起来很好但在移动视图中显示水平条我读到横条是由于容器流体所以到我使用 标记,但它不起作用

这是代码

    <nav class="navbar navbar-inverse">

    <div class="container-fluid">

        <div class="navbar-header">
           <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
        <a class="navbar-brand" href="#">RG ACADEMY</a>
        </div>
        <div class="collapse navbar-collapse" id="myNavbar">
          <ul class="nav navbar-nav">
            <li><a href="#">Home</a></li>

            <li class="dropdown">
              <a class="dropdown-toggle"  data-toggle="dropdown" href="#">About us <span class="caret"> </span> </a>
              <ul class="dropdown-menu">
                <li><a href="#about">About Academy</a></li>
                <li><a href="#">Faculty Team</a></li>
              </ul>
            </li>

            <li class="dropdown">
              <a class="dropdown-toggle" data-toggle="dropdown" href="#">Courses <span class="caret"> </span> </a>
              <ul class="dropdown-menu">
                <li><a href="#">JEE MAINS+ADVANCED</a></li>
                <li><a href="#">JEE MAINS</a></li>
              </ul>
            </li>


            <li class="dropdown">
              <a class="dropdown-toggle" data-toggle="dropdown" href="#">Results <span class="caret"> </span> </a>
              <ul class="dropdown-menu">
                <li><a href="#">IIT JEE 2015</a></li>
                <li><a href="#">JEE MAINS 2015</a></li>
              </ul>
            </li>

           <li class="dropdown">
              <a class="dropdown-toggle" data-toggle="dropdown" href="#">Exams Info <span class="caret"> </span> </a>
              <ul class="dropdown-menu"> 
                <li><a href="#">JEE MAINS + ADVANCED</a></li>
                <li><a href="#">BITSAT</a></li>
                <li><a href="#">KVPY</a></li>
              </ul>
           </li>

           <li class="dropdown">
            <a class="dropdown-toggle" data-toggle="dropdown" href="#">Downloads<span class="caret"> </span> </a>
              <ul class="dropdown-menu"> 
                <li><a href="#">IIT JEE Solutions</a></li>
                <li><a href="#">JEE MAINS</a></li>
                <li><a href="#">KVPY</a></li>
              </ul>
            </li>

            <li><a href="#">Enquiry</a></li>
            </ul>

           <ul class="nav navbar-nav navbar-right">
              <li><a href="#"><span class="glyphicon glyhicon-user"></span> Sign Up</a></li>
              <li><a href="#"><span class="glyphicon glyphicon-log-in"></span> Login</a></li>
           </ul>  

        </div>
    </div>

  </nav>

2 个答案:

答案 0 :(得分:1)

您可以使用:

overflow:hidden;

在css中或在html中声明它是deirect:

<style type="text/css">
.container-fluid {
    overflow-x:hidden;
    overflow-y:hidden;
    overflow:hidden;
}
</style>

我希望它有所帮助

答案 1 :(得分:0)

一切看起来都不错。您可能有一些自定义CSS做错了什么。我甚至尝试排除&#34; viewport&#34;元标记,仍然没有显示溢出。

&#13;
&#13;
<!DOCTYPE html>
<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">
    <title></title>
    <!-- Latest compiled and minified CSS -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
</head>

<body>
    <nav class="navbar navbar-inverse">

        <div class="container-fluid">

            <div class="navbar-header">
                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a class="navbar-brand" href="#">RG ACADEMY</a>
            </div>
            <div class="collapse navbar-collapse" id="myNavbar">
                <ul class="nav navbar-nav">
                    <li><a href="#">Home</a></li>

                    <li class="dropdown">
                        <a class="dropdown-toggle" data-toggle="dropdown" href="#">About us <span class="caret"> </span> </a>
                        <ul class="dropdown-menu">
                            <li><a href="#about">About Academy</a></li>
                            <li><a href="#">Faculty Team</a></li>
                        </ul>
                    </li>

                    <li class="dropdown">
                        <a class="dropdown-toggle" data-toggle="dropdown" href="#">Courses <span class="caret"> </span> </a>
                        <ul class="dropdown-menu">
                            <li><a href="#">JEE MAINS+ADVANCED</a></li>
                            <li><a href="#">JEE MAINS</a></li>
                        </ul>
                    </li>


                    <li class="dropdown">
                        <a class="dropdown-toggle" data-toggle="dropdown" href="#">Results <span class="caret"> </span> </a>
                        <ul class="dropdown-menu">
                            <li><a href="#">IIT JEE 2015</a></li>
                            <li><a href="#">JEE MAINS 2015</a></li>
                        </ul>
                    </li>

                    <li class="dropdown">
                        <a class="dropdown-toggle" data-toggle="dropdown" href="#">Exams Info <span class="caret"> </span> </a>
                        <ul class="dropdown-menu">
                            <li><a href="#">JEE MAINS + ADVANCED</a></li>
                            <li><a href="#">BITSAT</a></li>
                            <li><a href="#">KVPY</a></li>
                        </ul>
                    </li>

                    <li class="dropdown">
                        <a class="dropdown-toggle" data-toggle="dropdown" href="#">Downloads<span class="caret"> </span> </a>
                        <ul class="dropdown-menu">
                            <li><a href="#">IIT JEE Solutions</a></li>
                            <li><a href="#">JEE MAINS</a></li>
                            <li><a href="#">KVPY</a></li>
                        </ul>
                    </li>

                    <li><a href="#">Enquiry</a></li>
                </ul>

                <ul class="nav navbar-nav navbar-right">
                    <li><a href="#"><span class="glyphicon glyhicon-user"></span> Sign Up</a></li>
                    <li><a href="#"><span class="glyphicon glyphicon-log-in"></span> Login</a></li>
                </ul>

            </div>
        </div>

    </nav>
</body>

</html>
&#13;
&#13;
&#13;