Jump to content

How to freeze Navigation Item Link when reducing/expanding window size

Go to solution Solved by tuanphan,

Recommended Posts

Site URL: https://bassoon-oleander-texb.squarespace.com/

Site password: 12345

Right now, I have a "SHOP" Button in my navigation bar that I moved closer to the Cart icon using CSS edits to its spacing. However, when the window size is reduced/expanded, it moves with the other navigation items and the spacing I'm looking for gets messed up.

I've currently used multiple lines to edit the spacing based off the window size as a basic fix: 

@media only screen and (min-width: 1270px){.header-nav-item:nth-child(5){
  margin-left: 280px !important;
  margin-right: 5px !important;
  padding-right: 10px !important;}}

@media only screen and (max-width: 1270px){.header-nav-item:nth-child(5){

margin-left: 200px !important;
  margin-right: 5px !important;
  padding-right: 10px !important;}}

@media only screen and (max-width: 1200px){.header-nav-item:nth-child(5){
  margin-left: 180px !important;
  margin-right: 5px !important;
  padding-right: 10px !important;}}

etc....

However, I'm wondering if there is an easier fix to this and have that particular nav item (SHOP) behave like the Cart icon and Donate Button when the window size is expanded/reduced - so that it remains right-aligned to the window in the same relative position. Same thing when it comes to the grey backdrop. 

Any and all help would be greatly appreciated!

Link to comment
  • Replies 8
  • Created
  • Last Reply

Top Posters In This Topic

  • Solution

Try

@media screen and (min-width:992px) {
.header-nav-list {
    width: 100%;
}
.header-nav-item:nth-child(5) {
    flex: 10%;
    text-align: right;
    padding-right: 10px;
}
}

 

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

How to: Setup Password & Share url Insert Custom CSS - Page Header - Upload Custom Font - Upload File - Find Block ID - Contact Customer Care

Link to comment
On 4/11/2020 at 4:26 AM, tuanphan said:

Try


@media screen and (min-width:992px) {
.header-nav-list {
    width: 100%;
}
.header-nav-item:nth-child(5) {
    flex: 10%;
    text-align: right;
    padding-right: 10px;
}
}

 

@tuanphan 
 

Once again, thank you very much for the help! One quick question! The link now stretches from its current position (aligned right) to where its original position would be (next to the rest of the nav items), so that when you scroll over the area to the left of the text, the link is still active.

Do you happen to have a fix for this?

Link to comment
13 hours ago, greeniglu said:

@tuanphan 
 

Once again, thank you very much for the help! One quick question! The link now stretches from its current position (aligned right) to where its original position would be (next to the rest of the nav items), so that when you scroll over the area to the left of the text, the link is still active.

Do you happen to have a fix for this?

Not sure I understand your mean, or did you fix?

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

How to: Setup Password & Share url Insert Custom CSS - Page Header - Upload Custom Font - Upload File - Find Block ID - Contact Customer Care

Link to comment
15 minutes ago, greeniglu said:

@tuanphan

No fix as of yet!

The screenshot attached will show you. The link is activated even when the cursor hovers over the blank space to the left of it

 

Add to Home > Design > Custom CSS

.header .header-nav-wrapper a[href="/shop"] {
    display: inline-block;
}

 

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

How to: Setup Password & Share url Insert Custom CSS - Page Header - Upload Custom Font - Upload File - Find Block ID - Contact Customer Care

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.