引导带覆盖定制的导航栏

时间:2020-03-13 07:23:07

标签: html css twitter-bootstrap

退出引导程序,导航栏可以很好地工作,但是当我激活引导程序时,导航栏会出现问题,这是它的外观:enter image description here 引导程序的外观如下:enter image description here

我认为有些东西需要添加!important,但我不确定是什么原因,所以可以1 有经验告诉我哪一个? 我也尝试过inline-flex,但还是没有希望 我尝试了!important的宽度,但仍然无法正常工作 我尝试了height: 0%!important;,但仍然没有任何效果 我需要使用引导带使表具有引导程序设计,因此无法删除引导程序。

好,所以我不确定是否还有其他问题,但是似乎找不到答案,所以这是我的代码:

html {
  scroll-behavior: smooth;
}

#extra space {
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
}

#section2 {
  color: #fff;
  text-shadow: 0 0 0.5px rgba(255, 255, 255, 0.25);
  text-align: center;
  padding: 5em 0 5em 0;
  margin: 0;
  background-size: 125% auto;
}

#section2 header {
  margin: 0 0 2em 0;
}

* {
  margin: 0px;
  padding: 0px;
  box-sizing: border-box;
}

nav {
  position: sticky;
  top: 0;
  display: flex;
  justify-content: space-around;
  align-items: center;
  min-height: 12vh;
  background-color: #0c0c0c;
  overflow: auto;
}

.logo {
  color: whitesmoke;
  text-transform: uppercase;
  letter-spacing: 5px;
  font-size: 22px;
}

.nav-links {
  display: flex!important;
  justify-content: space-around!important;
  width: 100%!important;
}

.nav-links li {
  list-style: none;
}

.burger div {
  width: 25px;
  height: 5px;
  background-color: whitesmoke;
  margin: 3px;
}

.burger {
  display: none;
  cursor: pointer;
}

.nav-links a {
  color: whitesmoke;
  text-decoration: none;
  letter-spacing: 3px;
  text-transform: uppercase;
  font-size: 14px;
}

@media screen and (max-width:1024px) {
  .nav-links {
    display: inline-flex;
    justify-content: space-around;
    width: 60%;
  }
}

@media screen and (max-width:768px) {
  body {
    overflow-x: hidden;
  }
  .nav {
    position: fixed;
    top: 0;
  }
  .nav-links {
    font-size: 1px;
    position: fixed;
    right: 0px;
    height: 92vh;
    top: 0px;
    background-color: #0c0c0c;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 50%;
    transform: translateX(100%);
    transition: transform 0.5s ease-in;
  }
  .nav-links li {}
  .burger {
    display: block;
    position: absolute;
    top: 8px;
    right: 16px;
  }
  .nav-active {
    transform: translateX(0%);
  }
}

#section1 {
  background-image: url("background6.png");
  background-position: center center;
  background-repeat: no-repeat;
  width: 100vw;
  height: 100vh;
  background-attachment: fixed;
  background-size: cover;
  background-color: black;
}

#section2 {
  background-image: url("background image venuto4.jpg");
  height: 980px;
  width: 100%;
}

#section3 {
  background-color: black;
  height: 700px;
}

#section4 {
  background-color: whitesmoke;
  height: 700px;
}

#section5 {
  background-color: yellow;
  height: 700px;
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" rel="stylesheet" />
<!DOCTYPE HTML>
<!--
	Overflow by HTML5 UP
	html5up.net | @ajlkn
	Free for personal and commercial use under the CCA 3.0 license (html5up.net/license)
-->
<html>

<head>
  <title>Overflow by HTML5 UP</title>
  <meta charset="utf-8" />
  <link rel="stylesheet" href="navmain.css" />
  <link rel="stylesheet" href="css/bootstap.css">
  <script src="https://kit.fontawesome.com/703d63b52b.js" crossorigin="anonymous"></script>

</head>

<body>
  <nav>
    <div class="logo">
      <h4>thomas<br> venutu</h4>

    </div>
    <ul class="nav-links">
      <li><a href="#">home</a></li>
      <li><a href="#section2">NextEvent</a> </li>
      <li><a href="index">Music </a> </li>
      <li><a href="index">About</a> </li>
      <li><a href="index">Boooking</a> </li>

    </ul>

    <div class="burger">
      <div class="line2"></div>
      <div class="line1"></div>
      <div class="line3"></div>
    </div>
  </nav>

  <section id="section1">

  </section>
  <section id="section2">


    <header>
      <h1>&nbsp;&nbsp;</h1>
      <h2>Next event</h2>
      <h3>Venue At:</h3>
      <h4>TBA</h4>
    </header>
    <div id="getting-started">
      <div class="container">
        <div class="row">
          <div class="col-md-4 m-auto offset-lg-3 col-lg-5">
            <div class="card">
              <div class="card-header">
                <div class="card-body">
                  <table class="table" summary="date and time for the next event">
                    <tr>
                      <th>Days</th>
                      <th>Hours</th>
                      <th>Minutes</th>
                    </tr>
                    <tr>
                      <td id="day" class="display-4"></td>
                      <td id="hours" class="display-4"></td>
                      <td id="minutes" class="display-4"></td>
                    </tr>
                  </table>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
    <script src="../../Downloads/mftp_zip_2020_03_11_02_16_39/htdocs/assets/venuto/jquery.js"></script>
    <script src="../../Downloads/mftp_zip_2020_03_11_02_16_39/htdocs/assets/venuto/jquery.countdown.js"></script>
    <script src="../../Downloads/mftp_zip_2020_03_11_02_16_39/htdocs/assets/venuto/main2.js"></script>
    <!--conection to main.js !-->
  </section>

  <section id="section3">
    <h1>About</h1>
  </section>

  <section id="section4">
    <h1>Music</h1>
    <article class="container box style2">
      <div class="row gtr-0">
        <div class="col-3 col-12-mobile">
          <a href="icon brands fa-facebook-f" class="image fit"><img src="images/venuto/1798697_10202102944072424_1617307970_n.jpg" alt="" title="still in proggress" /></a>
        </div>
        <div class="col-3 col-12-mobile">
          <a href="images/fulls/06.jpg" class="image fit"><img src="images/venuto/1898181_10202102918071774_1708501880_n.jpg" alt="" title="still in proggress" /></a>
        </div>
        <div class="col-3 col-12-mobile">
          <a href="images/fulls/07.jpg" class="image fit"><img src="images/venuto/1901776_10202102917311755_760656742_n.jpg" alt="" title="still in proggress" /></a>
        </div>
        <div class="col-3 col-12-mobile">
          <a href="images/fulls/08.jpg" class="image fit"><img src="images/venuto/10275374_10202690394478317_8154904436564081527_o.jpg" alt="" title="still in proggress" /></a>
        </div>
      </div>
    </article>
  </section>
  <div id="section5"></div>
  <section>
    <h1>home</h1>
  </section>
  <script src="navbarjs.js"></script>
</body>

</html>

答案是您需要进行引导nav_bar

好东西,如果您在下面搜索答案,您会发现我接受的答案是一个很好的导航栏

2 个答案:

答案 0 :(得分:0)

问题在于您的结构,因为bootstrap具有自己的nav结构,因此您需要遵循该结构。

我只是将nav更改为bootstrap nav,并添加了链接

html{
	scroll-behavior: smooth;
}

#extra space{
	
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
}
.navbar-nav {
    justify-content: space-around;
 width: 100%;
}
#section2 {
		
		color: #fff;
		text-shadow: 0 0 0.5px rgba(255, 255, 255, 0.25);
		text-align: center;
		padding: 5em 0 5em 0;
		margin: 0;
		background-size: 125% auto;
	}



#section2 header {
			margin: 0 0 2em 0;
		}


	*{
	margin: 0px;
	padding: 0px;
	box-sizing: border-box;
}

nav{
position:sticky;
top:0;
display: flex;
justify-content: space-around;
align-items: center;
min-height: 12vh;
background-color: #0c0c0c;
	overflow: auto;
}

.logo{
	color:whitesmoke;
	text-transform: uppercase;
	letter-spacing: 5px;
	font-size:22px;
}

.nav-links{
	display:flex!important;
	justify-content: space-around!important;
	width: 100%!important;
	
	 
}
.nav-links li{
	list-style: none;
}

.burger div{
	width: 25px;
	height: 5px;
	background-color:whitesmoke;
	margin:3px;
}
.burger{
	display:none;
	cursor: pointer;
}

.nav-links a{
color:whitesmoke;
text-decoration: none;
letter-spacing: 3px;
text-transform: uppercase;
font-size: 14px;
}

@media screen and (max-width:1024px){
	.nav-links{
	display:inline-flex;
	justify-content: space-around;
	width: 60%;
	
	 
}
	
}

@media screen and (max-width:768px){
	body{
		overflow-x:hidden;
	}
	.nav{
		position: fixed;
		top: 0;
	}
	.nav-links{
		font-size: 1px;
		position:fixed;
		right:0px;
		height:92vh;
		top: 0px;
		background-color: #0c0c0c;
		display: flex;
		flex-direction: column;
		align-items: center;
		width: 50%;
		transform: translateX(100%);
		transition: transform 0.5s ease-in;
	}
	.nav-links li{
	
	}
	
	.burger{
		display: block;
		 position: absolute;
         top: 8px;
         right: 16px;
        
	}
	
	.nav-active{
	transform: translateX(0%);
	}
}
#section1 {
	background-image: url("background6.png");
	background-position: center center;
	background-repeat: no-repeat;
	width: 100vw;
	height: 100vh;
	background-attachment: fixed;
	background-size: cover;
	background-color:black;
	
	
}
#section2 {
	background-image:url("background image venuto4.jpg");
	height: 980px;
	width: 100%;
}
#section3 {
	background-color: black;
	height: 700px;
}
#section4 {
	background-color: whitesmoke;
	height: 700px;

}
#section5 {
	background-color: yellow;
	height: 700px;
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>

<!DOCTYPE HTML>
<!--
	Overflow by HTML5 UP
	html5up.net | @ajlkn
	Free for personal and commercial use under the CCA 3.0 license (html5up.net/license)
-->
<html>
	<head>
		<title>Overflow by HTML5 UP</title>
		<meta charset="utf-8" />
		<link rel="stylesheet" href="navmain.css" />
		<link rel="stylesheet" href="css/bootstap.css">
		<script src="https://kit.fontawesome.com/703d63b52b.js" crossorigin="anonymous"></script>
		
	</head>

	<body>
    <nav class="navbar navbar-expand-lg navbar-dark">
  <a class="navbar-brand" href="#"><div class="logo">
				<h4>thomas<br> venutu</h4>

			</div></a>
  <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
    <span class="navbar-toggler-icon"></span>
  </button>
  <div class="collapse navbar-collapse" id="navbarNav">
    <ul class="navbar-nav ">
      <li class="nav-item active">
        <a class="nav-link" href="#">Home </a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="#section2">NextEvent</a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="index">Music</a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="index">About</a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="index">Boooking</a>
      </li>
    </ul>
  </div>
</nav>
		
		<section id="section1">
			
		</section>
		<section id="section2">	
				
			
			<header>
				<h1>&nbsp;&nbsp;</h1>
					<h2>Next event</h2>
					<h3>Venue At:</h3>
					<h4>TBA</h4>
				</header>
				<div id="getting-started">
  <div class="container">
    <div class="row">
      <div class="col-md-4 m-auto offset-lg-3 col-lg-5">
        <div class="card">
          <div class="card-header">
            <div class="card-body">
              <table class="table" summary="date and time for the next event">
                <tr>
                  <th>Days</th>
                  <th>Hours</th>
                  <th>Minutes</th>
                </tr>
                <tr>
                  <td id="day" class="display-4"></td>
                  <td id="hours" class="display-4"></td>
                  <td id="minutes" class="display-4"></td>
                </tr>
              </table>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
				<script src="../../Downloads/mftp_zip_2020_03_11_02_16_39/htdocs/assets/venuto/jquery.js"></script> 
<script src="../../Downloads/mftp_zip_2020_03_11_02_16_39/htdocs/assets/venuto/jquery.countdown.js"></script> 
<script src="../../Downloads/mftp_zip_2020_03_11_02_16_39/htdocs/assets/venuto/main2.js"></script> <!--conection to main.js !-->
		</section>
		
		<section id="section3">
			<h1>About</h1>
		</section>
		
		<section id="section4">
			<h1>Music</h1>
			<article class="container box style2">
			<div class="row gtr-0">
						<div class="col-3 col-12-mobile"><a href="icon brands fa-facebook-f" class="image fit"><img src="images/venuto/1798697_10202102944072424_1617307970_n.jpg" alt="" title="still in proggress" /></a></div>
						<div class="col-3 col-12-mobile"><a href="images/fulls/06.jpg" class="image fit"><img src="images/venuto/1898181_10202102918071774_1708501880_n.jpg" alt="" title="still in proggress" /></a></div>
						<div class="col-3 col-12-mobile"><a href="images/fulls/07.jpg" class="image fit"><img src="images/venuto/1901776_10202102917311755_760656742_n.jpg" alt="" title="still in proggress" /></a></div>
						<div class="col-3 col-12-mobile"><a href="images/fulls/08.jpg" class="image fit"><img src="images/venuto/10275374_10202690394478317_8154904436564081527_o.jpg" alt="" title="still in proggress" /></a></div>
					</div>
				</article>
		</section>
		<div id="section5"></div>
		<section>
			<h1>home</h1>
		</section>
		<script src="navbarjs.js"></script>
	</body>	

</html>

答案 1 :(得分:0)

尝试一下

html{
	scroll-behavior: smooth;
}

#extra space{
	
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
}
#section2 {
		
		color: #fff;
		text-shadow: 0 0 0.5px rgba(255, 255, 255, 0.25);
		text-align: center;
		padding: 5em 0 5em 0;
		margin: 0;
		background-size: 125% auto;
	}



#section2 header {
			margin: 0 0 2em 0;
		}


	*{
	margin: 0px;
	padding: 0px;
	box-sizing: border-box;
}

.header {
  position:sticky;
  top:0;
  min-height: 12vh;
  background-color: #0c0c0c;
}

.logo{
	color:whitesmoke;
	text-transform: uppercase;
	letter-spacing: 5px;
	font-size:22px;
}

.nav-links{
	display:flex!important;
	justify-content: space-around!important;
	width: 100%!important;
	
	 
}
.nav-links li{
	list-style: none;
}

.burger div{
	width: 25px;
	height: 5px;
	background-color:whitesmoke;
	margin:3px;
}
.burger{
	display:none;
	cursor: pointer;
}

.nav-links a{
color:whitesmoke;
text-decoration: none;
letter-spacing: 3px;
text-transform: uppercase;
font-size: 14px;
}

@media screen and (max-width:1024px){
	.nav-links{
	display:inline-flex;
	justify-content: space-around;
	width: 60%;
	
	 
}
	
}

@media screen and (max-width:768px){
	body{
		overflow-x:hidden;
	}
	.nav{
		position: fixed;
		top: 0;
	}
	.nav-links{
		font-size: 1px;
		position:fixed;
		right:0px;
		height:92vh;
		top: 0px;
		background-color: #0c0c0c;
		display: flex;
		flex-direction: column;
		align-items: center;
		width: 50%;
		transform: translateX(100%);
		transition: transform 0.5s ease-in;
	}
	.nav-links li{
	
	}
	
	.burger{
		display: block;
		 position: absolute;
         top: 8px;
         right: 16px;
        
	}
	
	.nav-active{
	transform: translateX(0%);
	}
}
#section1 {
	background-image: url("background6.png");
	background-position: center center;
	background-repeat: no-repeat;
	width: 100vw;
	height: 100vh;
	background-attachment: fixed;
	background-size: cover;
	background-color:black;
	
	
}
#section2 {
	background-image:url("background image venuto4.jpg");
	height: 980px;
	width: 100%;
}
#section3 {
	background-color: black;
	height: 700px;
}
#section4 {
	background-color: whitesmoke;
	height: 700px;

}
#section5 {
	background-color: yellow;
	height: 700px;
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" rel="stylesheet"/>
<!DOCTYPE HTML>
<!--
	Overflow by HTML5 UP
	html5up.net | @ajlkn
	Free for personal and commercial use under the CCA 3.0 license (html5up.net/license)
-->
<html>
	<head>
		<title>Overflow by HTML5 UP</title>
		<meta charset="utf-8" />
		<link rel="stylesheet" href="navmain.css" />
		<link rel="stylesheet" href="css/bootstap.css">
		<script src="https://kit.fontawesome.com/703d63b52b.js" crossorigin="anonymous"></script>
		
	</head>

	<body>
		<header class="header d-flex align-items-center container-fluid">
      <div class="row align-items-center flex-grow-1">
        <div class="col-auto">
          <div class="logo">
				  <h4>thomas<br> venutu</h4>
			    </div>
        </div>
        <div class="col">
          <nav>			
			      <ul class="nav-links">
				      <li><a href="#">home</a></li>
				      <li><a href="#section2">NextEvent</a> </li>
				      <li><a href="index">Music </a> </li>
				      <li><a href="index">About</a> </li>
				      <li><a href="index">Boooking</a> </li>
			      </ul>

			      <div class="burger">
				    <div class="line2"></div>
				    <div class="line1"></div>
				    <div class="line3"></div>
			      </div>
		      </nav>
        </div>
      </div>
    </header>
		
		<section id="section1">
			
		</section>
		<section id="section2">	
				
			
			<header>
				<h1>&nbsp;&nbsp;</h1>
					<h2>Next event</h2>
					<h3>Venue At:</h3>
					<h4>TBA</h4>
				</header>
				<div id="getting-started">
  <div class="container">
    <div class="row">
      <div class="col-md-4 m-auto offset-lg-3 col-lg-5">
        <div class="card">
          <div class="card-header">
            <div class="card-body">
              <table class="table" summary="date and time for the next event">
                <tr>
                  <th>Days</th>
                  <th>Hours</th>
                  <th>Minutes</th>
                </tr>
                <tr>
                  <td id="day" class="display-4"></td>
                  <td id="hours" class="display-4"></td>
                  <td id="minutes" class="display-4"></td>
                </tr>
              </table>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
				<script src="../../Downloads/mftp_zip_2020_03_11_02_16_39/htdocs/assets/venuto/jquery.js"></script> 
<script src="../../Downloads/mftp_zip_2020_03_11_02_16_39/htdocs/assets/venuto/jquery.countdown.js"></script> 
<script src="../../Downloads/mftp_zip_2020_03_11_02_16_39/htdocs/assets/venuto/main2.js"></script> <!--conection to main.js !-->
		</section>
		
		<section id="section3">
			<h1>About</h1>
		</section>
		
		<section id="section4">
			<h1>Music</h1>
			<article class="container box style2">
			<div class="row gtr-0">
						<div class="col-3 col-12-mobile"><a href="icon brands fa-facebook-f" class="image fit"><img src="images/venuto/1798697_10202102944072424_1617307970_n.jpg" alt="" title="still in proggress" /></a></div>
						<div class="col-3 col-12-mobile"><a href="images/fulls/06.jpg" class="image fit"><img src="images/venuto/1898181_10202102918071774_1708501880_n.jpg" alt="" title="still in proggress" /></a></div>
						<div class="col-3 col-12-mobile"><a href="images/fulls/07.jpg" class="image fit"><img src="images/venuto/1901776_10202102917311755_760656742_n.jpg" alt="" title="still in proggress" /></a></div>
						<div class="col-3 col-12-mobile"><a href="images/fulls/08.jpg" class="image fit"><img src="images/venuto/10275374_10202690394478317_8154904436564081527_o.jpg" alt="" title="still in proggress" /></a></div>
					</div>
				</article>
		</section>
		<div id="section5"></div>
		<section>
			<h1>home</h1>
		</section>
		<script src="navbarjs.js"></script>
	</body>	

</html>