Jump to content

How to style a dropdown menu?

Recommended Posts

Hi folks, I'd like to make a change on my site and need your help.

I'd like to modify the dropdown menu and style it as follows: The shape and spacing should resemble what is shown in the attached screenshot. The text (the links) should be left-aligned. The hover effect should remain as it is now. I would also like to be able to change the color of the menu background.

I would greatly appreciate your assistance!

Site: https://maltemartenmethod.squarespace.com/
Pword: maltemartenmethod2023


Bildschirmfoto2024-01-04um22_53_35.thumb.png.bcfbad8a141b0e07608018bfa07fac75.png

Link to comment

Thank you @tuanphan, that works so far.

How can I style the background of the menu to look like the screenshot I sent above (Dropdown menu just like here on the Squarespace Forum page)? It should be centered below the navigation menu items with an upward-pointing 'cap' at the top. There should be some more space above the links and between the links in the dropdown menu.

Could you assist me with this again?

Link to comment

Thank you @tuanphan, that worked. However, I would still like to style the dropdown menu as shown in the screenshot: a bit more spacing above the header navigation and a bit more space between the items in the menu itself. Additionally, I'd like to have an arrow shape at the top - do I need to upload an image for that, or can it be styled using code? I'm looking forward to your assistance.

Here's how I want it:
image.thumb.png.be1929ea0489b6420136850fb5e2eba9.png

Here's how it looks now:
image.png.d54f9cca8d9fb4f9f07f7b3179d051c9.png

Link to comment

Use this CSS code

.header-nav-folder-item {
    margin-bottom: 20px;
}

.header-nav-folder-content:before {
    content: "";
    position: absolute;
    width: 30px;
    height: 30px;
    background-color: #5b767a !important;
    left: 50%;
    top: -10px;
    transform: translateX(-50%) rotate(45deg);
}

.header-nav-folder-content {
    margin-top: 10px;
}

image.png.30426d4131e98df04050074966872f09.png

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!)

Link to comment

Thank you @tuanphan, that looks pretty good already.

One thing is not working quite right. When moving the cursor from the navigation points like 'Online Courses' down to the dropdown menu, it always disappears, and you can't select the items in the dropdown menu. It only works when moving the cursor over the small downward arrow. I would like the dropdown menu to be less cumbersome to select.

Look forward to further assistance!

Link to comment

Thanks @tuanphan, you can now move the cursor down without the dropdown menu disappearing, but the code disrupts the spacing, etc. The dropdown menu moves up, and the underline when activating the navigation points appears, moving downward. Unfortunately, I don't like it this way. Is there another way to fix the problem? Looking forward to further assistance!

Site: https://maltemartenmethod.squarespace.com/
Pword: maltemartenmethod2023

Link to comment
On 1/11/2024 at 9:36 AM, tuanphan said:

Try this CSS under

div.header-nav-item>a {
    height: 40px !important;
    display: flex !important;
    align-items: center;
}

.header-nav-folder-content {
    top: 25px !important;
}

 

You can remove the code, I will try testing code again

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!)

Link to comment
  • 2 weeks later...
On 1/10/2024 at 8:48 PM, Nomis said:

Thank you @tuanphan, that looks pretty good already.

One thing is not working quite right. When moving the cursor from the navigation points like 'Online Courses' down to the dropdown menu, it always disappears, and you can't select the items in the dropdown menu. It only works when moving the cursor over the small downward arrow. I would like the dropdown menu to be less cumbersome to select.

Look forward to further assistance!

@tuanphan could you take another look at it? Unfortunately, the same issue still persists. I would greatly appreciate your help!

Link to comment

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.