我有以下问题:我试图通过应用 MVC 模式来调整系统,一方面我有一个文件php
用于页面的页眉,另一个用于页脚,另一个用于内容。一切都很顺利,直到尝试放置示例中所示的内容时,它与导航重叠并放置在页面的左上角,就好像它的顶部和左侧边距为 0。
我希望将任何内容放在它应该放在的位置,即导航栏下方。有什么建议吗?
一个 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>
还有一个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>
我还添加了所有内容以防css
万一
@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;
}
发生在您的样式中,特别是nav上的“固定顶部”类,这些属性使导航重叠并参考窗口移动,无论窗口下方或上方是什么。
这就是为什么你的内容 div 出现在那一边的原因。解决方案是删除该类,但如果您仍想保留该类,请将 a 添加
margin-top: 10rem(Lo que requiera);
到您的内容 div。