I have relatively minimal experience with HTML and CSS but have been learning as I go along as I am building a website. Problem is that the navbar dropdown has stopped working but if I copy the code into a tool like W3schools it does work. I have been fiddling for hours and just need someone more experienced to tell me where i've gone wrong. Please see Index.html below:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-
awesome.min.css">
<title>Ichor Studios</title>
<style type="text/css">
body
/*{
background-image: url(Media/Background.png);
background-repeat: no-repeat;
background-size: cover;
}
}
/* Header/Logo Title */
.header {
padding: 30px;
background-position: center;
text-align: center;
color: white;
font-size: 60px;
background-repeat: no-repeat;
background-color:#313131;
background-size: cover;
}
.footer {
padding: 0px;
width: 100%;
height: 40px;
position: fixed;
z-index: 10;
bottom: 0;
left: 0;
text-align: center;
color: white;
font-size: 20px;
background-color:#313131;
background-image: url("Media/footer.png");
background-repeat: no-repeat;
background-position: center;
}
/* Add a black background color to the top navigation */
.topnav {
overflow: hidden;
background-color: #333;
}
/* Style the links inside the navigation bar */
.topnav a {
float: left;
color: #f2f2f2;
text-align: center;
padding: 14px 16px;
text-decoration: none;
font-size: 17px;
}
.active {
background-color: #4CAF50;
color: white;
}
.dropdown .dropbtn a {
float: left;
color: #f2f2f2;
text-align: center;
padding: 14px 16px;
text-decoration: none;
font-size: 17px;
}
/* Add a color to the active/current link */
.topnav a.active {
background-color: #4CAF50;
color: white;
}
.dropdown {
float: left;
overflow: hidden;
z-index: 99999;
}
.dropdown .dropbtn {
font-size: 16px;
border: none;
outline: none;
color: white;
padding: 14px 16px;
background-color: inherit;
font-family: inherit;
margin: 0;
}
.topnav a:hover, .dropdown:hover .dropbtn {
background-color: dimgrey;
}
.dropdown-content {
display: none;
position: absolute;
background-color: #f9f9f9;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
z-index: 99999;
}
.dropdown-content a {
float: none;
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
text-align: left;
z-index: 99999;
}
.dropdown-content a:hover {
background-color: #ddd;
color: black;
z-index: 99999;
}
.dropdown:hover .dropdown-content {
display: block;
</style>
<div class="header">ICHOR STUDIOS
</div>
<div class="topnav">
<a class="active" href="index.html">Home</a>
<div class="dropdown">
<button class="dropbtn">Current Projects
<i class="fa fa-caret-down"></i>
</button>
<div class="dropdown-content">
<a href="oot2d.html">OOT2D</a>
<a href="tower-defence.html">Tower Defence</a>
<a href="the-delicious-prince.html">The Delicious Prince</a>
</div>
Update Logs
FAQ's
Contact
About
Previous
Next
This is test text which will describe the image above in a way that compels people
to
click and find out more about what we have to offer etc. This is test text which
will describe the
image above in a way that compels people to click and find out
more about what we have to offer
etc.
This is test text which will describe the image above in a way that compels people
to
click and find out more about what we have to offer etc. This is test text which
will describe the
image above in a way that compels people to click and find out
more about what we have to offer
etc.
<script src="js/jquery-3.3.1.min.js"></script>
<script src="js/popper.min.js"></script>
<script src="js/bootstrap-4.3.1.js"></script>
<!-------------------------------------------------------------SCRIPT FOR CAROUSEL END----------------------------------------------->
</style>
<link href="css/bootstrap-4.3.1.css" rel="stylesheet" type="text/css">
</head>
<body>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body {
margin: 0;
font-family: Arial, Helvetica, sans-serif;
}
<div class="container">
<div class="sliding-background"></div>
<style type="text/css">
</div>
.container {
overflow: hidden;
}
#container {
height: 100%;
width: 1920px;
position: relative;
margin-right: auto;
margin-left: auto;
}
#leftcolumn {
float: left;
height: auto;
width: auto;
}
#rightcolumn {
float: right;
height: auto;
width: auto;
}
#container2 {
float: right;
height: 230px;
width: 1200px;
}
#rightcolumn-right {
padding-top: 16px;
float: right;
height: 200px;
width: auto;
}
#rightcolumn-left {
padding-top: 16px;
float: left;
height: 200px;
width: auto;
}
</div>
</html>
question from:
https://stackoverflow.com/questions/65896326/topnav-dropdown-is-not-working-in-browser-but-does-work-in-the-w3schools-editor 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…