html – How do I create a responsive, clickable dropdown menu on flexbox?-ThrowExceptions

Exception or error:

I’m trying to build my portfolio website with only very very basic knowledge on HTML and CSS. I took a template from html5up and I’ve just been editing it at very slow place.

So far I’ve been able to put in most of the changes I want except for this clickable dropdown thing. I’m trying to copy imitate this animation but integrating to “Explore” and just having it at the style of my website: https://jsfiddle.net/icebob/m7o1Lase/

<header id="header">
  <div><a href="index.html" class="title">AIKY CRUZ DESIGN</a></div>
  <div class="submenu">
    <ul>
      <li><a href="uxuispread.html" class="drop">UX/UI Projects</a></li>
      <li><a href="conceptspread.html" class="drop">Concept Designs</a></li>
    </ul>
  </div>
  <div><a href="#" class="navitem">Explore<i class="fa fa-caret-down" style="margin-left: 10px;"></i></a></div>
  <div><a href="index.html#wrapper" class="navitem">About Me</a></li></div>
  <div><a href="index.html#four" class="navitem">Contact</a></div>
</header>
#header {
  display: -moz-flex;
  display: -webkit-flex;
  display: -ms-flex;
  display: flex;
  background-color: #1b1b1b;
  cursor: default;
  padding: 1.75em 2em;
  position: fixed;
  /* Set the navbar to fixed position */
  z-index: 1000;
  top: 0;
  /* Position the navbar at the top of the page */
  width: 100%;
}

#header>.title {
  font-family: 'hansonbold';
  border: 0;
  color: #ffffff;
  display: block;
  font-size: 1.25em;
  font-weight: bold;
}

#header>div>a.navitem {
  margin: 0px 15px 0px 15px;
  position: relative;
}

#header>div.submenu {
  -moz-flex: 1;
  -webkit-flex: 1;
  -ms-flex: 1;
  flex: 1;
  position: absolute;
  text-align: right;
  list-style: none;
}

#header>div.submenu>ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: none;
}

#header>nav>div {
  display: inline-block;
  margin-left: 1.75em;
  padding: 0;
  vertical-align: middle;
  cursor: pointer;
}

#header>nav>ul>li:first-child {
  margin-left: 0;
}

#header>nav>ul>li a {
  border: 0;
  color: rgba(255, 255, 255, 0.35);
  display: inline-block;
  font-size: 0.6em;
  font-weight: bold;
  letter-spacing: 0.25em;
  text-transform: uppercase;
}

#header>nav>ul>li a:hover {
  color: #95dae7;
}

#header>nav>ul>li a.active {
  color: #edd9bf;
  line-height: 24px;
}

@media screen and (max-width: 736px) {
  #header {
    padding: 1em 2em;
  }
}

@media screen and (max-width: 480px) {
  #header {
    display: block;
    padding: 0 2em;
    text-align: left;
  }
  #header .title {
    font-size: 1.25em;
    padding: 1em 0;
  }
  #header>nav {
    border-top: solid 1px rgba(255, 255, 255, 0.15);
    text-align: inherit;
  }
  #header>nav>ul>li {
    margin-left: 1.5em;
  }
  #header>nav>ul>li a {
    height: 6em;
    line-height: 6em;
  }
}
How to solve:

Leave a Reply

Your email address will not be published. Required fields are marked *