Jump to content

[Share] Second button on Header

Recommended Posts

Posted

You can use this tip to add second button to Header

#1. With Personal Plan (doesn't support Code Injection)

My idea is turn last two navigation items to button style.

Use this code to Website Tools > Custom CSS

nav {
    align-items: center;
}
div.header-nav-item:last-child>a {
    background-color: #f1f;
    color: white !important;
    padding-left: 20px;
    padding-right: 20px;
    padding-top: 10px;
    padding-bottom: 10px;
}
div.header-nav-item:nth-last-child(2)>a {
    background-color: #ff2;
    color: blue !important;
    padding-left: 20px;
    padding-right: 20px;
    padding-top: 10px;
    padding-bottom: 10px;
}

image.thumb.png.578ecfed53b43c2772ffe2dd7c420fee.png

with Mobile, use this CSS code

.header-menu-nav-wrapper>div.header-menu-nav-item:last-child>a {
    background-color: #f1f;
    color: white !important;
    padding-left: 20px;
    padding-right: 20px;
    padding-top: 10px;
    padding-bottom: 10px;
    display: inline-block;
}
.header-menu-nav-wrapper>div.header-menu-nav-item:nth-last-child(2)>a {
    background-color: #ff2;
    color: blue !important;
    padding-left: 20px;
    padding-right: 20px;
    padding-top: 10px;
    padding-bottom: 10px;
    display: inline-block;
}

image.png.76da7ef1349d96c6627bff9dd7ac3239.png

#2. With Business Plan/higher

You can use #1, or use this following code to add button next to current header button

You can add code to Website Tools > Code Injection > Footer

<a class="btn btn--border theme-btn--primary-inverse sqs-button-element--primary second-button" href="https://google.com">Contact</a>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.0/jquery.min.js"></script>
<script>
  $(document).ready(function(){
    $('a.second-button').insertAfter('a.btn');
});
</script>

and this code to Custom CSS box

a.second-button {
    display: none;
}
header#header a.second-button {
    background-color: black !important;
    color: #f1f !important;
    display: inline-block !important;
}

image.thumb.png.3dfae436fb562cdc0fae3704cfb6c419.png

image.png.82aec769ff599228d47c92c4f5d42cac.png

To make button appear before current Header button, just change this to insertBefore

image.png.c670288399481d75da5851b71b3a7538.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!)

  • 4 weeks later...
  • Replies 5
  • Views 3.5k
  • Created
  • Last Reply

Top Posters In This Topic

  • 1 month later...
Posted

So I added the code and it is on the site and functioning as it should! How do I format it to match the correct font and make them the same size button?

Here is the link to the website: https://www.powerhouseonbroadway.com

The original button is "Reserve Now" and I want to format the new button "Order Now" to match the same size and style. Thank you!

  • 3 months later...
Posted

Hello!

I used the above code to add a second button to my website header and it worked like a charm, however there is no space between both buttons (see attached picture). Is there any code I can use to add space between my two buttons?

Thank you for your help!

image.png.03bf68fa3d2dd4bfe5b8f72354627a57.png

Posted
18 hours ago, laubouuuu said:

Hello!

I used the above code to add a second button to my website header and it worked like a charm, however there is no space between both buttons (see attached picture). Is there any code I can use to add space between my two buttons?

Thank you for your help!

image.png.03bf68fa3d2dd4bfe5b8f72354627a57.png

You can use this to Custom CSS

a.second-button {
	margin-right: 1.6vw;
}

 

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.