Skip Navigation

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

Problem:
The client is using WPML with Brick Builder and has added two language switchers using WordPress shortcodes. They want to customize the CSS for these switchers but are having trouble overriding the existing WPML CSS.

Solution:
We recommended using the

!important

declaration in their custom CSS to ensure that their styles have higher priority over the default WPML styles. For example:

.wpml-ls-legacy-dropdown a {<br />color: #f1f1f1 !important;<br />background-color: transparent !important;<br />}

We also explained that WPML, like any other plugin or theme, has its own HTML IDs and Classes that can be targeted with custom CSS to modify the design. The

!important

declaration is a common method to override existing styles when they are not being applied due to lower specificity or conflicts with other styles.

If this solution does not apply to your case, or if it seems outdated, we highly recommend checking the related known issues, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If you still encounter issues, please do not hesitate to open a new support ticket. You can reach our support forum here.

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.

Tagged: 

This topic contains 3 replies, has 2 voices.

Last updated by Mihai Apetrei 1 year, 4 months ago.

Assisted by: Mihai Apetrei.

Author Posts
February 2, 2024 at 12:42 am #15257282

denisS-34

Hello,

I am switching my blog to Brick Builder and I am using WPML.
On my website I have 2 different language switcher, one in the header as dropdown and a normal one in the footer.

I added the two switcher with the wordpress shortcode.

However, I want to change the way they are looking with CSS. In general the CSS is not the problem. My issue is I don't know how to get rid of the existing CSS.

For example I changed the color and background of the dropdown like this:
.wpml-ls-legacy-dropdown a {
color: #f1f1f1;
background-color: transparent;
}

But the CSS from WMPL is still existing in the code and overriding my settings.

How can I properly change the CSS to adapt to my liking?

Thank you and best regards

February 3, 2024 at 12:12 am #15261523

Mihai Apetrei
WPML Supporter since 03/2018

Languages: English (English )

Timezone: Europe/Bucharest (GMT+03:00)

Hi there.

Try to add "!important" and see if anything changes:

.wpml-ls-legacy-dropdown a {
color: #f1f1f1 !important;
background-color: transparent !important;
}

Please let me know how things go.

Mihai Apetrei

February 4, 2024 at 12:51 pm #15263449

denisS-34

That worked. But that literally means, I don't have a possibility to change the CSS of WMPL. I can only make the browser choose my settings with the "!important" property?

Maybe you should consider to implement that as it produces better CSS.

February 5, 2024 at 9:12 pm #15268397

Mihai Apetrei
WPML Supporter since 03/2018

Languages: English (English )

Timezone: Europe/Bucharest (GMT+03:00)

Hi there.

WPML, like any other plugin or theme, comes with custom HTML IDs and Classes that can be used together with CSS to further customize the design of all WPML-related things. Also, WPML comes with its own design (so its own CSS code).

There are times when existing active plugins (or the active theme) are overwriting the WPML CSS and things don't look as they would on a test site where only WPML is enabled and a default-WordPress theme is being used.

Also, like for any other theme or plugin, you can use custom CSS to overwrite any styling that you don't like or that you are looking to modify.

So the "!important" code part does exactly that: sets a "higher" priority for your code so that you can overwrite the default styling.

I hope things are clearer now.

Mihai

February 5, 2024 at 9:24 pm #15268406

denisS-34

You didn't answer any of my questions. But it's OK, it works with the "!important". I would just be happy to have a chance to produce clear CSS.
Still thank you for taking the time to reply.