Jump to content

Language switch: transforming text into flags

Go to solution Solved by tuanphan,

Recommended Posts

URL: cantinalepietre.com

Hi guys, I have two language switch ENG and ITA for Italian, I want to use flags instead.

I've tried adding this code:

   /* REPLACE ENG/ITA WITH FLAGS */
  $('.lang-en').html('<img src="https://cdn.countryflags.com/thumbs/united-kingdom/flag-round-250.png" alt="English">');
  $('.lang-it').html('<img src="https://cdn.countryflags.com/thumbs/italy/flag-round-250.png" alt="Italiano">');
 

But it's not working since the flags cover all the items in the menu

Link to comment
  • Solution

Try adding to Design > Custom CSS

header#header div.header-nav-item:last-child>a {
    background-image: url(https://cdn.countryflags.com/thumbs/united-kingdom/flag-round-250.png);
    background-size: 30px;
    background-repeat: no-repeat;
    color: transparent;
}
header#header div.header-nav-item:nth-last-child(2)>a {
    background-image: url(https://cdn.countryflags.com/thumbs/italy/flag-round-250.png);
    background-size: 30px;
    background-repeat: no-repeat;
    color: transparent;
}

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

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.