Padding-top does not work in the content below the navbar of the bootstrap, in the browser firefox

0

Context: I'm using Bootstrap as a framework for the interface part and django for the business rules part and database access for a website I'm developing.

The problem: I have two navbar's, one for the menu on the top and one for the footer. However, when I add content just below the navbar, the content is hidden behind the navbar. But this only happens in firefox.

I have already added padding-top in the container tag where the content will be just below the navbar, but the content is not behind the navbar. I've also used -moz, @moz-document and z-index but nothing happened.

HTML code of the page in question:

<!DOCTYPE html>
{% load static %}
<html lang="pt-br">
    <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>LEDS - Laborátorio de Sistemas Embarcados e Distribuidos</title>
        <script src="{% static 'bootstrap-3.3.2/js/jquery-1.11.2.js' %}"></script>
        <link href="{% static 'bootstrap-3.3.2/css/bootstrap.css' %}" rel="stylesheet">

        <!-- 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="">
    </head>
{#    class gradiente deixa o background padrao com duas cores do topo pro bottom#}
    <body class="gradient">
    <!-- NAVBAR
    ================================================== -->
    <nav class="navbar navbar-default navbar-fixed-top">
        <div class="container">
            <div class="col-md-2">
                <a href="{% url 'core:home' %}">
                <img data-holder-rendered="true" src="/media/customLogo2.png" class="featurette-image img-responsive"
                     data-src="holder.js/500x500/auto" alt="300x80"></a>
            </div>
            <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>
                <a class="navbar-brand" href="{% url 'core:home' %}">Home</a>
            </div>
            <div id="navbar" class="navbar-collapse collapse">
                <ul class="nav navbar-nav">
                <li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">LEDS <span class="caret"></span></a>
                    <ul class="dropdown-menu" role="menu">
                        <li><a href="#">Projetos</a></li>
                        <li><a href="#">Publicações</a></li>
                        <li><a href="{% url 'documentos-tecnicos:documentos_tecnicos' %}">Documentos</a></li>
                    </ul>
                </li>
                <li><a href="#">Eventos</a></li>
                <li><a href="#">Contatos</a></li>
                <li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Quem Somos<span class="caret"></span></a>
                    <ul class="dropdown-menu" role="menu">
                        <li><a href="#">Associados</a></li>
                        <li><a href="#">Parceiros</a></li>
                        <li><a href="#">O laboratório</a></li>
                    </ul>
                </li>
                </ul>
                <ul class="nav navbar-nav navbar-right">
                    {% if user.is_authenticated %}
                        <p class="navbar-text">Bem vindo, {{ user }}</p>
                        <li class="active"><a href="{% url 'contas:logout' %}">Sair <span class="sr-only">(current)</span></a></li>
                    {% else %}
                        <p class="navbar-text">Usuario</p>
                        <li class="active"><a href="{% url 'contas:login' %}">Login <span class="sr-only">(current)</span></a></li>
                    {% endif %}
                </ul>
            </div><!--/.nav-collapse -->
        </div>
    </nav>

    <div class="container">
        <div class="row">
            <h2>DOCUMENTOS TÉCNICOS</h2>
            <form>
                <div class="form-group">
                    <label for="exampleInputFile">File input</label>
                    <input type="file" id="exampleInputFile">
                    <p class="help-block">Example block-level help text here.</p>
                </div>
            </form>
        </div>
    </div>

    <footer class="modal-footer navbar-fixed-bottom">
        <div class="container">
            <p class="text-muted">Instituto  (CNPJ: /0010-36)</p>
            <p class="text-muted">Rod. . CEP: 60 | Fone: 6-8100</p>
        </div>
    </footer>

     <script src="{% static 'bootstrap-3.3.2/js/bootstrap.js' %}"></script>
     <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script><!--Includeallcompiledplugins(below),orincludeindividualfilesasneeded--><scriptsrc="{% static 'bootstrap-3.3.2/js/bootstrap.min.js' %}"></script>

  </body>
</html>

None of the Bootstrap classes I've used in navbar and content have been changed.

    
asked by anonymous 26.03.2015 / 23:29

1 answer

2

The example below works correctly in Chrome and Firefox. A margin-top is given to elements with the class container except those that are within nav . The reason for using margin and not padding is because if the content itself is large - greater than or equal to the padding used - its use will have no effect, while the margin is guaranteed content below a certain point:

.container {
  margin-top: 100px;
}

nav .container {
  margin-top: 0;
}
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script><scriptsrc="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>

<!-- NAVBAR
    ================================================== -->
    <nav class="navbar navbar-default navbar-fixed-top">
        <div class="container">
            <div class="col-md-2">
                <a href="{% url 'core:home' %}">
                <img data-holder-rendered="true" src="/media/customLogo2.png" class="featurette-image img-responsive"
                     data-src="holder.js/500x500/auto" alt="300x80"></a>
            </div>
            <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>
                <a class="navbar-brand" href="{% url 'core:home' %}">Home</a>
            </div>
            <div id="navbar" class="navbar-collapse collapse">
                <ul class="nav navbar-nav">
                <li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">LEDS <span class="caret"></span></a>
                    <ul class="dropdown-menu" role="menu">
                        <li><a href="#">Projetos</a></li>
                        <li><a href="#">Publicações</a></li>
                        <li><a href="{% url 'documentos-tecnicos:documentos_tecnicos' %}">Documentos</a></li>
                    </ul>
                </li>
                <li><a href="#">Eventos</a></li>
                <li><a href="#">Contatos</a></li>
                <li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Quem Somos<span class="caret"></span></a>
                    <ul class="dropdown-menu" role="menu">
                        <li><a href="#">Associados</a></li>
                        <li><a href="#">Parceiros</a></li>
                        <li><a href="#">O laboratório</a></li>
                    </ul>
                </li>
                </ul>
                <ul class="nav navbar-nav navbar-right">
                    {% if user.is_authenticated %}
                        <p class="navbar-text">Bem vindo, {{ user }}</p>
                        <li class="active"><a href="{% url 'contas:logout' %}">Sair <span class="sr-only">(current)</span></a></li>
                    {% else %}
                        <p class="navbar-text">Usuario</p>
                        <li class="active"><a href="{% url 'contas:login' %}">Login <span class="sr-only">(current)</span></a></li>
                    {% endif %}
                </ul>
            </div><!--/.nav-collapse -->
        </div>
    </nav>

    <div class="container">
        <div class="row">
            <h2>DOCUMENTOS TÉCNICOS</h2>
            <form>
                <div class="form-group">
                    <label for="exampleInputFile">File input</label>
                    <input type="file" id="exampleInputFile">
                    <p class="help-block">Example block-level help text here.</p>
                </div>
            </form>
        </div>
    </div>

    <footer class="modal-footer navbar-fixed-bottom">
        <div class="container">
            <p class="text-muted">Instituto  (CNPJ: /0010-36)</p>
            <p class="text-muted">Rod. . CEP: 60 | Fone: 6-8100</p>
        </div>
    </footer>

(when you scroll the screen, of course, the content goes behind navbar - because you indicated that you wanted it fixed at the top)

    
27.03.2015 / 00:17