Jump to content

Additional button in desktop and mobile menu

Go to solution Solved by Mahmoud,

Recommended Posts

Posted (edited)

Site URL: https://www.theauctionrooms.co.uk/

I currently have some custom code in place to create the attached header menu. The "book a day pass" and "book a meeting room" text are set up as links that need to look like buttons. 

The "book a day pass" is new, and I can't figure out how to make it look the same and aligned to the right of the page, as well as appearing within the mobile menu.

Can anyone help?

image.png

Edited by NMcMurray
  • Replies 3
  • Views 469
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

  • Solution
Posted (edited)

Hi,

The current custom code applied to create a header menu button is not scalable. You need to deactivate that CSS code first by commenting it out and then paste my following CSS code:

.header-nav-list div:not(:last-child):has(a[target='_blank']) {
    position: absolute;
    right: 14rem;
}

.header-nav-list div:last-child:has(a[target='_blank']) {
    position: absolute;
    right: 0;
}

.header-nav-list a[target='_blank'], 
.header-menu-nav-wrapper a[target='_blank'] {
    display: inline-block;
    background-color: #586f79;
    padding: 10px 20px;
    border-radius: 50px;
}

@media only screen and (max-width: 1250px) {
    .header-nav-list .header-nav-item:has(+ div:not(:last-child) a[target='_blank'])  {
        margin-right: auto;
    }
}

I used a bit more advanced CSS selectors to write fewer lines of code, to make it scalable and work on mobile view too.

N.B.: At a viewport width of 1250px, the elements will overlap. To prevent this, I aligned the navbar links to the left as per the attached. Also, the above code only works on header buttons that will open a new tab when clicked.

Remember to comment out the current custom CSS codes for the header menu button first before applying my codes.

Hope this helps!

Mahmoud

Issue.PNG

Fix.PNG

Edited by Mahmoud
Posted

Hi Mahmoud, thank you so much for sending across a solution! It works perfectly and resolves the issues with scalability. Many thanks Nicola

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.