Jump to content

Changing social link icon. CSS Code for icon only changes in mobile view and not desktop.

Recommended Posts

Posted

Hey everyone! 

I've added my Strava account to my website header, but need to code in the icon since Squarespace doesn't have a designated icon for Strava yet. 

I found a code someone wrote for exactly this, but my problem is it only changes the icon in mobile view and not desktop, even though the coding is there for both views. I double checked that the icon file is the same for both, yet it doesn't effect the desktop icon.

Here's there code:

@media only screen and (min-width:640px) { 
  .header-actions-action--social .icon--fill:nth-of-type(2) {
    svg {
      display:none;
    }    
    background-image: url(https://static1.squarespace.com/static/64509c14481e4e2dc47465b4/t/652185b7d4fcb0001aa3190d/1696695735215/4691462_strava_icon-3.png);    
    background-size: 100%;    
    background-repeat: no-repeat;  
  } 
}  
.header-menu-actions-action:nth-of-type(2) {    
  svg { 
    display:none;    
  }    
  background-image: url(https://static1.squarespace.com/static/64509c14481e4e2dc47465b4/t/652185b7d4fcb0001aa3190d/1696695735215/4691462_strava_icon-3.png));    
  background-size: 100%;    
  background-repeat: no-repeat;  
}

 

I guess I am confused what is wrong with the desktop code vs the mobile code. I attached screen shots of the website header below in each view.

Any help is much appreciated!

Thank you! 

 

Screenshot 2023-10-07 at 2.44.37 PM.png

Screenshot 2023-10-07 at 2.45.22 PM.png

  • Replies 6
  • Views 1.4k
  • Created
  • Last Reply

Top Posters In This Topic

Posted

Use this code for desktop

header#header [href*="strava"] svg {
      display:none;
    }    
header#header [href*="strava"] {
    background-image: url(https://static1.squarespace.com/static/64509c14481e4e2dc47465b4/t/652185b7d4fcb0001aa3190d/1696695735215/4691462_strava_icon-3.png);    
    background-size: 100%;    
    background-repeat: no-repeat;  
  } 

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

Posted

Thank you for the response!

 

Strangely that didn't change anything 😕 I will play around with it to see if that changes anything.

Here's the full CSS text, let me know if I copy/pasted it in incorrectly

 
@media only screen and (min-width:640px) { 
  header#header [href*="strava"] svg {
      display:none;
    }    
header#header [href*="strava"] {
    background-image: url(https://static1.squarespace.com/static/64509c14481e4e2dc47465b4/t/652185b7d4fcb0001aa3190d/1696695735215/4691462_strava_icon-3.png);    
    background-size: 100%;    
    background-repeat: no-repeat;  
  } 
}  
.header-menu-actions-action:nth-of-type(2) {    
  svg { 
    display:none;    
  }    
  background-image: url(https://static1.squarespace.com/static/64509c14481e4e2dc47465b4/t/6521892e5d0d443c8af5d959/1696696622560/strava-svgrepo-com.png);    
  background-size: 100%;    
  background-repeat: no-repeat;  
  }
}

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.