为什么我的网站页面中有一些文字隐藏在导航栏(引导程序)后面?

eni*_*c05 4 html css twitter-bootstrap

我只是尝试了解引导程序,并将我的代码写入类型 php 文件,如下所示:

  <!DOCTYPE html>
     <html lang="en">
     <head>
        <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 -->
        <title>Bootstrap 101 Template</title>
        <!-- Bootstrap -->
        <link href="css/bootstrap.min.css" rel="stylesheet">
        <!-- HTML5 shim and Respond.js for 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/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>
              padding-top: 70px;
        </style>
        <div class="navbar navbar-default  navbar-fixed-top" role="navigation">
        <div class="container">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".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>
            <a class="navbar-brand" href="#">Wisuda  </a>
        </div>
        <div class="navbar-collapse collapse">
            <ul class="nav navbar-nav navbar-right">
                <li class="active"><a href="#">Home</a></li>
                <li><a href="#">About</a></li>
                <li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown">Loggin<b class="caret"></b></a>
                    <ul class="dropdown-menu">
                        <li><a href="#">Mahasiswa</a></li>
                        <li><a href="#">Prodi</a></li>
                        <li><a href="#">bb</a></li>
                    </ul>    
                </li>
             </ul>
        </div>
   </div> 
</div>
<div class="container">
    <div class="row">
        <div class="col-md-12">
            <h1>Bootstrap starter template</h1>
            <p class="lead">Use this document as a way to quickly start any new project.<br> All you get is this text and a mostly barebones HTML document.</p>
        </div>
    </div>
</div>
<!-- Fixed Footer -->
<div  class="navbar navbar-inverse navbar-fixed-bottom" role="navigation">
    <div class="container">
        <div class="navbar-text pull-left">
            <p>© my</p>
        </div>
    </div>
</div>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="js/bootstrap.min.js"></script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

当我测试预览时 在此处输入图片说明

为什么有些文本(‘ Bootstrap starter template ’)隐藏在我的导航栏标题后面?有什么帮助吗?

Jo *_*Smo 6

这是因为CSS你的位置navbar

您可以添加navbar-static-top到您的navbar是这样的:

<nav class="navbar navbar-default navbar-static-top">
Run Code Online (Sandbox Code Playgroud)

或者你可以margin-bottom在你的navbar CSS班级中添加一些。

更新

在你的情况下,你可以更换

<style>
    padding-top: 70px;
</style>
Run Code Online (Sandbox Code Playgroud)

<style>
    .navbar{
        margin-bottom: 50px !important;
    }
</style>
Run Code Online (Sandbox Code Playgroud)

或将边距添加到您的自定义CSS类中。