Jump to content

Creating a drop down on a word

Recommended Posts

Posted

Site URL: https://www.rotaterecordings.com

Hi,

This might be pretty out there and hard to explain but on the first page that loads when going to my site I have a much of headings in the middle of the page which all link to individual shop pages (this was done to try and best get around the 200 product limit per shop page). Unfortunately at the moment migrating to 7.1 isn't an option. 

 

I was wondering if there was anyway that I would be able to create a dropdown situation on some of these categories seeing as I need to break them down a little bit further?

 

I've included a picture to try and describe what I am talking about.

Image 18-2-22 at 8.49 pm.jpg

  • Replies 1
  • Views 292
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

Posted

Add a Code Block there >> paste this code

<div class="dropdown">
  <button class="dropbtn" for="btnControl">14. Dropdown</button>
  <div class="dropdown-content">
    <a href="https://google.com">Link 1</a>
    <a href="https://facebook.com">Link 2</a>
    <a href="https://instagram.com">Link 3</a>
  </div>
</div>
<style>
  .dropbtn {
  background-color: #f9f9f9;
  color: #0f0f0f;
  padding: 16px;
  font-size: 16px;
  border: none;
  cursor: pointer;
  min-width: 160px;
  box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
}

.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-content {
  position: absolute;
  background-color: #f9f9f9;
  box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
  z-index: 98;
  max-height: 0;
  min-width: 160px;
  transition: max-height 0.15s ease-out;
  overflow: hidden;
}

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

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

.dropdown:hover .dropdown-content {
  max-height: 500px;
  min-width: 160px;
  transition: max-height 0.25s ease-in;
}

.dropdown:hover .dropbtn {
  background-color: #f9f9f9;
  border-bottom: 1px solid #e0e0e0;
  transition: max-height 0.25s ease-in;
}

</style>

 

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Create an account or sign in to comment

You need to be a member in order to leave a comment


×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.