I have the following problem: I am trying to modulate the system by applying the MVC pattern, and on the one hand I have a file php
for the header of the page, another for the footer and another for the content. Everything was going well until, when trying to put a content like the one shown in the example, it overlaps the nav and is placed at the top left of the page, as if it had 0 margin top and left.
I want whatever the content was to be placed where it should be, which is below the navigation bar. Any suggestion?
A header.php
<nav class="navbar navbar-light navbar-expand-md justify-content-center fixed-top pt-0 w-100" id="navigation-bar">
<div class="container">
<div class="navbar-collapse collapse justify-content-between align-items-center w-100 " id="collapsingNavbar2">
<ul class="topBotomBordersOut navbar-nav mx-auto text-center">
<li class="nav-item active pt-4">
<a class="nav-link" href="#">Home</a>
</li>
<li class="nav-item pt-4">
<a class="nav-link" href="#">My Glossaries</a>
</li>
<li class="nav-item pt-4">
<a class="nav-link" href="#">Al Glossaries</a>
</li>
</ul>
</div>
</div>
<div class="navbar-custom-menu float-lg-right">
<ul class="nav topBotomBordersOut navbar-nav mx-auto text-center">
<li class="nav-item pt-4">
<a href="#" class="nav-link" data-toggle="dropdown" id="user-button">
<img src="" class="user-image">
<span class="hidden-xs">Logout</span>
</a>
</li>
</ul>
</div>
</nav>
And a content.php
<div class="content">
<div class="row">
<div class="col-4">Aca iria</div>
<div class="col-4">El contenido</div>
<div class="col-4">Principal</div>
</div>
I also add everything just css
in case
@import url(http://fonts.googleapis.com/css?family=Numans);
html,
body {
background-color: #D8A7B1;
height: 100%;
font-family: 'Numans', sans-serif;
}
a {
color: #fff !important;
}
.nav-item {
font-family: Century Gothic;
margin: 0 auto;
padding: 5em 3em;
text-align: center;
}
.nav-item a {
color: #FFF;
text-decoration: none;
font: 20px Century Gothic;
margin: 0px 10px;
padding: 10px 10px;
position: relative;
z-index: 0;
}
/* Top & Bottom Borders Out */
.topBotomBordersOut a:before,
.topBotomBordersOut a:after {
position: absolute;
left: 0px;
width: 100%;
height: 2px;
background: #FFF;
content: "";
opacity: 0;
-webkit-transition: all 0.3s;
transition: all 0.3s;
}
.topBotomBordersOut a:before {
top: 0px;
transform: translateY(10px);
}
.topBotomBordersOut a:after {
bottom: 0px;
transform: translateY(-10px);
}
.topBotomBordersOut a:hover:before,
.topBotomBordersOut a:hover:after {
opacity: 1;
transform: translateY(0px);
}
.container {
height: 100%;
align-content: center;
position: relative;
}
.card {
height: 370px;
margin-top: auto;
margin-bottom: auto;
width: 400px;
background-color: rgba(0, 0, 0, 0.5) !important;
}
.social_icon span {
font-size: 60px;
margin-left: 10px;
color: #FAE8E0;
}
.social_icon span:hover {
color: white;
cursor: pointer;
}
.card-header h3 {
color: white;
}
.social_icon {
position: absolute;
right: 20px;
top: -45px;
}
.input-group-prepend span {
width: 50px;
background-color: #FAE8E0;
;
color: black;
border: 0 !important;
}
input:focus {
outline: 0 0 0 0 !important;
box-shadow: 0 0 0 0 !important;
}
.remember {
color: white;
}
.remember input {
width: 20px;
height: 20px;
margin-left: 15px;
margin-right: 5px;
}
.login_btn {
color: black;
background-color: #FAE8E0;
width: 100px;
}
.login_btn:hover {
color: black;
background-color: white;
}
.links {
color: white;
}
.links a {
margin-left: 4px;
}
#user-button {
text-decoration: none;
}
.navigation-bar {
position: absolute;
}
.content {
position: relative;
}
What happens is in your styles, specifically the " fixed-top " class on your nav , those properties make the nav overlap and move with reference to the window no matter what is below or above it.
That's why your content div comes out on that side. The solution would be to remove that class, but if you still want to keep that class, add a
margin-top: 10rem(Lo que requiera);
to your content div.