我无法使用下拉菜单在HTML / CSS上运行

时间:2019-03-16 05:13:51

标签: html5 css3

我一直在尝试获取项目的交互式简历页面的下拉菜单项。我似乎无法正常工作。我尝试使用Google搜索以获取结果,但有些结果更糟。我尝试咨询有关堆栈溢出的其他答案,但似乎没有一个解决之道。总体而言,它基本上破坏了我其他页面的结构。现在,我只想着眼于现在修补首页。

/* /// Footer Section /// */

.footer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background-color: #00cca3;
  text-align: center;
  color: black;
}


/* Navigation/Menu Bar */

.navbar {
  overflow: hidden;
  background-color: #00cca3;
  position: fixed;
  top: 0;
  width: 100%;
}

.navbar a {
  float: none;
  display: inline;
  font-size: 18px;
  text-align: center;
  color: black;
  padding: 20px 20px;
}


/* .navbar a:hover, a:active {
    float: none;
    display: inline;
    font-size: 18px;
    text-align: center;
    color: white;
    padding: 40px 60px;
    text-decoration: none;
    background-color: #00e6b8;
}

.navbar a:link, a:visited {
    color: white;
    padding: 40px 60px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
} */

.dropdown {
  float: right;
  overflow: hidden;
}

.dropdown .dropbtn {
  border: none;
  outline: none;
  color: black;
  padding: 20px 20px;
  font-family: inherit;
  margin: 0;
  background-color: #00cca3
}

.navbar a:hover,
.dropdown:hover .dropbtn {
  background-color: #00e6b8;
}

.dropdown-content {
  display: list-item;
  position: absolute;
  background-color: #00cca3;
  min-width: 160px;
  box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
  z-index: 1;
}

.dropdown-content a {
  float: left;
  color: black;
  padding: 12px 16px;
  text-decoration: none;
  display: block;
  text-align: left;
}

.dropdown-content a:hover {
  background-color: #00e6b8;
}

.dropdown:hover .dropdown-content {
  display: block;
}
<!DOCTYPE html>
<html lang="en-US">

<head>
  <title>
    Interactive Resume
  </title>
  <meta charset="UTF-8">
  <meta name="Project" content="Code for Online Interactive Resume">
  <meta name="viewport" content="width=device-width, initial-scale= 1.0">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
  <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css" integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/" crossorigin="anonymous">
  <link rel="stylesheet" type="text/css" href="style/css.css" />
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
  <script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.3.1.min.js"></script>
  <script src="scripts/script.js"></script>
</head>

<body>
  <div class="navbar">
    <a href="index.html"><i class="fas fa-home"></i> Home</a>
    <a href="exp.html"><i class="fas fa-briefcase"></i> Experience</a>
    <a href="port.html"><i class="fas fa-folder-open"></i> Portfolio </a>
    <div class="dropdown">
      <button class="dropbtn">
                <i class="fas fa-caret-down"></i>
            </button>
      <div class="dropdown-content">
        <a href="jq.html">jQuery Project</a>
        <a href="json.html">JSON Project</a>
        <a href="php.html">PHP Project</a>
        <a href="sql.html">SQL Project</a>
        <a href="py.html">Python Project</a>
        <a href="cpp.html">C++ Project</a>
      </div>
    </div>
    <a href="about.html"><i class="fas fa-question-circle"></i> About</a>
    <a href="contact.html"><i class="fas fa-phone"></i> Contact</a>
  </div>

1 个答案:

答案 0 :(得分:0)

Demo

/* /// Footer Section /// */



/* Navigation/Menu Bar */

.navbar {
  background-color: #00cca3;
  position: fixed;
  top: 0;
  width: 100%;
}

.navbar a {
  float: none;
  display: inline;
  font-size: 18px;
  text-align: center;
  color: black;
  padding: 20px 20px;
}

/* .navbar a:hover, a:active {
    float: none;
    display: inline;
    font-size: 18px;
    text-align: center;
    color: white;
    padding: 40px 60px;
    text-decoration: none;
    background-color: #00e6b8;
}

.navbar a:link, a:visited {
    color: white;
    padding: 40px 60px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
} */

/*.dropdown {
  float: right;
  overflow: hidden;
}

.dropdown .dropbtn {
  border: none;
  outline: none;
  color: black;
  padding: 20px 20px;
  font-family: inherit;
  margin: 0;
  background-color: #00cca3
}

.navbar a:hover,
.dropdown:hover .dropbtn {
  background-color: #00e6b8;
}

.dropdown-content {
  display: list-item;
  position: absolute;
  background-color: #00cca3;
  min-width: 160px;
  box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
  z-index: 1;
}

.dropdown-content a {
  float: left;
  color: black;
  padding: 12px 16px;
  text-decoration: none;
  display: block;
  text-align: left;
}

.dropdown-content a:hover {
  background-color: #00e6b8;
}

.dropdown:hover .dropdown-content {
  display: block;
}*/

.dropbtn {
  color: white;
  padding: 16px;
  font-size: 16px;
  border: none;
  background-color: #00cca3;
}

.dropdown {
  position: relative;
  display: inline-block;
  background-color: #00cca3;
}

.dropdown-content {
  display: none;
  position: absolute;
  background-color: #00cca3;
  min-width: 160px;
  box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
  z-index: 5;
}

.dropdown-content a {
  color: black;
  padding: 12px 16px;
  text-decoration: none;
  display: block;
}

.dropdown-content a:hover {
  background-color: #00e6b8;
}

.dropdown:hover .dropdown-content {
  display: block;
}

.dropdown:hover .dropbtn {
  background-color: #00e6b8;
}
<!DOCTYPE html>
<html lang="en-US">

<head>
  <title>
    Interactive Resume
  </title>
  <meta charset="UTF-8">
  <meta name="Project" content="Code for Online Interactive Resume">
  <meta name="viewport" content="width=device-width, initial-scale= 1.0">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
  <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css" integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/" crossorigin="anonymous">
  <link rel="stylesheet" type="text/css" href="style/css.css" />
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
  <script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.3.1.min.js"></script>
  <script src="scripts/script.js"></script>
</head>

<body>
  <div class="navbar">
    <a href="index.html"><i class="fas fa-home"></i> Home</a>
    <a href="exp.html"><i class="fas fa-briefcase"></i> Experience</a>
    <a href="port.html"><i class="fas fa-folder-open"></i> Portfolio </a>
    <div class="dropdown">
      <button class="dropbtn">
                <i class="fas fa-caret-down"></i>
            </button>
      <div class="dropdown-content">
        <a href="jq.html">jQuery Project</a>
        <a href="json.html">JSON Project</a>
        <a href="php.html">PHP Project</a>
        <a href="sql.html">SQL Project</a>
        <a href="py.html">Python Project</a>
        <a href="cpp.html">C++ Project</a>
      </div>
    </div>



    <a href="about.html"><i class="fas fa-question-circle"></i> About</a>
    <a href="contact.html"><i class="fas fa-phone"></i> Contact</a>
  </div>