gpt4 book ai didi

javascript - Bootstrap 菜单将另一个 div 推开

转载 作者:行者123 更新时间:2023-11-28 03:17:17 25 4
gpt4 key购买 nike

我有这个问题,我的 Bootstrap 菜单将另一个名为“title”的 div 向下推(在移动设备上,xs)到目前为止网站链接:http://20162.hosts.ma-cloud.nl/portfoliowebsite

我真的不知道我现在应该做什么,因为我希望菜单向下,但 div“标题”留在原处。

HTML:

    <!DOCTYPE html>
<html lang="en">

<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta charset="UTF-8">
<meta name="author" content="Daniel Gotz">
<title>Daniel Gotz | Porfolio </title>
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/styles.css" rel="stylesheet">
<link href="css/scrolling-nav.css" rel="stylesheet">
<link href="dist/hamburgers.css" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Exo+2:600,900|Roboto" rel="stylesheet">
</head>

<body id="page-top" data-spy="scroll" data-target=".navbar-fixed-top">

<!-- Navigation -->

<section id="intro" class="intro-section">
<nav class="navbar navbar-default" role="navigation">
<div class="navbar-header page-scroll">
<button class=" hamburger hamburger--spin navbar-toggle visible-xs" type="button" data-toggle="collapse" data-target=".navbar-ex1-collapse"> <span class=" hamburger-box">
<span class=" hamburger-inner"></span> </span>
</button>
</div>
<div class="collapse navbar-collapse navbar-ex1-collapse">
<ul class="nav navbar-nav right">
<li class="hidden">
<a class="page-scroll" href="#page-top"></a>
</li>
<li> <a class="page-scroll" href="#intro">Intro</a> </li>
<li> <a class="page-scroll" href="#mijnwerk">Mijn werk</a> </li>
<li> <a class="page-scroll" href="#overdaniel">Over Daniel</a> </li>
<li> <a class="page-scroll" href="#contact">Contact</a> </li>
</ul>
</div>
</nav>
<div class="title">
<h1> Every mountain top is within reach if you just keep climbing</h1> </div>

<div class="berg">
<img src="berg.svg">


</div>


</section>
<section id="mijnwerk" class="about-section"> </section>
<section id="overdaniel" class="services-section"> </section>
<section id="contact" class="contact-section"> </section>
<!-- jQuery -->
<script src="js/jquery.js"></script>
<!-- Bootstrap Core JavaScript -->
<script src="js/bootstrap.min.js"></script>
<!-- Scrolling Nav JavaScript -->
<script src="js/jquery.easing.min.js"></script>
<script src="js/scrolling-nav.js"></script>
<script src="js/hamburgers.js"></script>
</body>

</html>

CSS:

    .overflow {
overflow-x: hidden;
position: relative;
}

.home {
height: 100vh;
width: 100vw;
background-color: #2ecc71;
}

.mijnwerk {
height: 100vh;
width: 100vw;
background-color: #27ae60;
}


.navbar-default {
background: none;
border-style: none;
}

.right {
float: right;
text-align: right;

}

.navbar-default .navbar-nav>li>a {
font-family: 'Roboto', sans-serif;
color: #ecf0f1;
font-size: 14px;


}

.nav>li>a {
padding: 15px 25px;
border-style: none;



}

.navbar-default .navbar-nav>li>a:focus,
.navbar-default .navbar-nav>li>a:hover {
color: #ecf0f1;
border-style: none;

}

.navbar-default .navbar-toggle:focus,
.navbar-default .navbar-toggle:hover {
background: none


}

.navbar-default .navbar-collapse,
.navbar-default .navbar-form {
border-style: none;



}



h1 {

font-family: 'Exo 2' , sans-serif;
font-weight: 900;
font-size: 37px;
line-height: 60px;


}

.title {
z-index: 2;
font-family: 'Exo 2' , sans-serif;
margin-left: auto;
margin-right: auto;
vertical-align: center;
text-align: center;
width: 350px;
position: relative;
top: 35%;
transform: translateY(-50%);

}

.berg {
position: absolute;
width: 100%;
bottom: 0;
margin: 0 0 -2px 0;

body {
width: 100%;
height: 100%;
}

html {
width: 100%;
height: 100%;
}

@media(min-width:767px) {
.navbar {

}

.top-nav-collapse {
padding: 0;
}
}

.intro-section {
height: 100%;
background: #2ecc71;
color: white;
text-align: center;


}

.about-section {
height: 100%;
background: #27ae60;
}

.services-section {
height: 100%;
background: #3498db;
}

.contact-section {
height: 100%;
padding-top: 150px;
text-align: center;
background: #eee;
}

最佳答案

尝试绝对定位您的 .title div。

.title {
font-family: 'Exo 2', sans-serif;
text-align: center;
width: 350px;
position: absolute;
top: 45%;
left: 50%;
transform: translate(-50%, -50%);
}

关于javascript - Bootstrap 菜单将另一个 div 推开,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45402696/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com