Jump to content

How to add a call to action button in main navigation? (Hyde Template)

Recommended Posts

Hi all,

I'm a new user to Squarespace and I'm looking for some help.

I want to add a call to action button in my main navigation for the last link (Get Your Invite)

I've already tried a bunch of other css codes which have been posted as answers in previous questions before, however they don't seem to work with my Hyde template.

My website is - www.varaoptical.com

Any suggestions and answers will be highly appreciated, thanks!

Link to comment
  • Replies 43
  • Views 15.9k
  • Created
  • Last Reply

Hi,

You can try this. It targets the last item in your menu on both desktop and mobile:alt text


.Header-nav.Header-nav--primary .Header-nav-inner > a:last-of-type, .Mobile-overlay-nav.Mobile-overlay-nav--primary > a:last-of-type {
 border: 2px solid white;
 padding: 10px 30px;
 border-radius: 300px;
}

If you want to target only desktop, use this part:


.Header-nav.Header-nav--primary .Header-nav-inner > a:last-of-type { 
 border: 2px solid white;
 padding: 10px 30px;
 border-radius: 300px;
}

For only mobile, use this:


.Mobile-overlay-nav.Mobile-overlay-nav--primary > a:last-of-type {
     border: 2px solid white;
     padding: 10px 30px;
     border-radius: 300px;
   }

You might want to alter the height of your header so the button fits properly.Also, you'll have to modify the width of the button in mobile if you want to keep the same style, otherwise it will look misaligned.

Hope that helps.

B.

screen-shot-2017-05-08-at-62211-pm.png.cc22e7f42d47ebe0497c8a6c95435a72.png

Squarespace Customization Geek | Helping fellow designers code the heck out of Squarespace

☞ Get the free Squarespace Coding Essentials guide to reach that next level of customization you're aiming for.

☞ Check out all the plugins & mini-courses and masterclasses available to help speed up your projects.

☞ Looking to outsource a customization or fix? I'd love to help you out. Get in touch!

 

Website | Youtube | Facebook | Pinterest

Link to comment

You're most welcome :)

Squarespace Customization Geek | Helping fellow designers code the heck out of Squarespace

☞ Get the free Squarespace Coding Essentials guide to reach that next level of customization you're aiming for.

☞ Check out all the plugins & mini-courses and masterclasses available to help speed up your projects.

☞ Looking to outsource a customization or fix? I'd love to help you out. Get in touch!

 

Website | Youtube | Facebook | Pinterest

Link to comment
  • 3 months later...

I'm really happy to hear that. You're welcome! :)

Squarespace Customization Geek | Helping fellow designers code the heck out of Squarespace

☞ Get the free Squarespace Coding Essentials guide to reach that next level of customization you're aiming for.

☞ Check out all the plugins & mini-courses and masterclasses available to help speed up your projects.

☞ Looking to outsource a customization or fix? I'd love to help you out. Get in touch!

 

Website | Youtube | Facebook | Pinterest

Link to comment
  • 11 months later...
  • 1 year later...
  • 1 month later...

Hello everyone,

I'm currently working on a site where I've put the call to action button in a pill-shape like this:

.Header-nav.Header-nav--primary .Header-nav-inner > a:last-of-type, .Mobile-overlay-nav.Mobile-overlay-nav--primary > a:last-of-type {
   border: 2px solid white;
   padding: 10px 30px;
   border-radius: 300px;
 }

 

The only issue is that on all other pages but the landing page the background is also white! Please can someone help me write a code to have a white border on the landing page, but black on all other pages.

 

Thank you so much in advance

Link to comment
  • 3 months later...
  • 1 month later...
21 hours ago, ChristineRedFrog said:

Is there a code for the Five template to have the last link look like a button?

nav#main-navigation ul li:last-child a {
    background: #000;
    color: #fff;
    font-size: 15px;
    padding: 5px 10px;
}

 

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
  • 3 weeks later...
42 minutes ago, HospiceGeorgianTriangle said:

Add to Home > Design > custom CSS

nav#mainNavigation>div:last-child>a {
    background: red;
    color: white;
    border-radius: 20px;
}

 

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...

Hello! I've added the code but see that anything that drops down to show more links in my header navigation are also affected by this code. Here's my website to see what I mean, it affects the "About" "Photography" and "Education" tabs: www.rachellewelling.com

Does anyone know a code to fix this so the code only makes the "Contact" a button?

Link to comment
18 hours ago, Rachellemb said:

Hello! I've added the code but see that anything that drops down to show more links in my header navigation are also affected by this code. Here's my website to see what I mean, it affects the "About" "Photography" and "Education" tabs: www.rachellewelling.com

Does anyone know a code to fix this so the code only makes the "Contact" a button?

Remove code you used & add this

nav#main-navigation>ul>li:last-child a {
    background: red;
}

 

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
  • 4 weeks later...

@tuanphan When I used the code you recommended to convert a header navigation link into a button on a site using the Avenue template

 

Quote

 

With Avenue Template, use this code


.main-nav li:last-child a {
   background: #000;
   color: #fff !important;
   padding: 10px 20px !important;
   border-radius: 20px;
}

 

 

the button became out of line with the rest of the navigation links. How can I fix?

Custom-Navigation-Button-display-1.thumb.png.f81959e730dacd0ac1c634f5d856e929.png

 

Thank you in advance for your help.

Link to comment
3 hours ago, kherzog said:

Here's the link to the live site: https://www.lynnemeade.com/

.main-nav li:last-child a {
   background: #000;
   color: #fff !important;
   padding: 10px 20px !important;
   border-radius: 20px;
}
@media screen and (min-width:641px) {
#topNav nav ul {
    display: flex;
    align-items: center;
}
}

 

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

 @tuanphan, thank you so much for getting back to me on a Saturday! The code worked like a charm. : -)

The call-to-action button improves navigation user experience 10X. I narrowed the size slightly. When we launch the shop, I'll move the button to the shop link. I already figured out how to do that.

You have my gratitude.

Link to comment

@tuanphan I just looked at the custom button on link fix to the last link on right side, on our site "Contact" link. When I rolled over links that were in folders ("About" and "Collections"), a button appears on the last link in the folder. How can I fix that display issue?

I've attached image of extra button issue on computer desktop. Same display is happening on mobile. Live site is https://www.lynnemeade.com/

Custom-Navigation-Button-display-2.thumb.png.f5650614dea734fb21299f1bb5f74427.png

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.