Skip to content Skip to sidebar

This thread is resolved. Here is a description of the problem and solution.

Problem:
The client is using the [wpml_language_selector_widget] shortcode to place a language switcher on their site and wants to increase the space between the languages in the dropdown list. The padding CSS property is not providing the desired effect.
Solution:
We recommend adding custom CSS to target the language switcher items directly. Here is the CSS code that should be added to the custom CSS section of the theme:

.wpml-ls-statics-shortcode_actions a {
    padding-top: 18px !important;
    padding-bottom: 18px !important;
    padding-left: 15px !important;
}

This code will add more space between the dropdown items. For more information on styling the language switcher, please refer to our documentation: How to fix styling and CSS issues for the language switchers.

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 3 replies, has 2 voices.

Last updated by Noman 1 year, 7 months ago.

Assisted by: Noman.

Author Posts
December 26, 2023 at 1:38 pm #15130233

al-mahaB

Hello,
I have a rather simple question but can’t find the answer. I use shortcode [wpml_language_selector_widget] to place language switcher and trying to stylize it in the Language switcher options, Additional CSS. My problem is the languages in the drop-down list are too close to each-other. I need to increase the space between them and padding doesn’t help:

.wpml-ls {
font-size: 14px;
padding: 15px;
}

Screenshot 2023-12-26 at 10.23.06 AM.png
December 26, 2023 at 2:13 pm #15130319

Noman
WPML Supporter since 06/2016

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi,

Thank you for contacting WPML Support. I’ve tried to visit your site but it seems your site is coming soon mode that’s why I can’t see the language switcher.

I just added the WPML language switcher with the [wpml_language_selector_widget] shortcode on my test site and I’m able to add the space between items by using the below CSS:

.wpml-ls-statics-shortcode_actions .wpml-ls-sub-menu a {
    padding: 20px 5px;
}

In the custom CSS section of the theme and now it looks as in the attached screenshot. Could you please try to use the above CSS and see if this resolves your issue.

Here is my test site link: hidden link

Here is a doc for more details: https://wpml.org/documentation/getting-started-guide/language-setup/language-switcher-options/how-to-fix-styling-and-css-issues-for-the-language-switchers/

If the issue still persists, could you please try to disable the coming soon mode for a moment so that I can access to your site and provide you with correct CSS according to your site.

Thank you

language switcher space.png
December 26, 2023 at 3:14 pm #15130396

al-mahaB

Hello, thank you for the code. It helped to increase the space between languages, but I also need to increase the padding top and bottom of the first item so it would look the same size as the sub-menu items. Also some padding to the left. I have enabled the site.

Screenshot 2023-12-26 at 12.11.01 PM.png
December 26, 2023 at 4:09 pm #15130442

Noman
WPML Supporter since 06/2016

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thanks for enabling the site. Can you please replace my previous CSS with this one:

.wpml-ls-statics-shortcode_actions a {
    padding-top: 18px !important;
    padding-bottom: 18px !important;
    padding-left: 15px !important;
}

And it will look as in the attached screenshot. You may update the CSS values 18px/15px to any number according to your needs.

Please let me know if this resolves your issue or if you need further assistance with this issue.

Thank you

updated switcher.png
December 26, 2023 at 4:29 pm #15130513

al-mahaB

This is very helpful, thank you very much for your support!