CSS Classes Not Applied In Custom.css File - Question | JoomShaper

CSS Classes Not Applied In Custom.css File

M

Michelangelo

Helix Framework 10 months ago

Hi, I set those classes in a custom.css file I created in \templates\shaper_helixultimate\css folder.

.megamenufoniafacile .sp-dropdown-inner { background-color: #fcc200 !important; border: 2px solid #ffffff !important; left: 0px !important;} .megamenunavigafacile .sp-dropdown-inner { background-color: #03789E !important; border: 2px solid #ffffff !important;} .megamenuassistenz .sp-dropdown-inner { background-color: #40b1e2 !important; border: 2px solid #ffffff !important;}

If i set those rules in my external custom.css one of them, in turn, does not work properly and, by using browser inspecting instrument, the css class is not loaded at all while for the other two is correctly loaded.

How is it possible? Is there some setting I've not done?

Thank you

0
32 Answers
Asfakur Rahman Saikat
Asfakur Rahman Saikat
Accepted Answer
Support Agent 10 months ago #184441

Hi Michelangelo,

Thank you for reaching out, and sorry for the inconvenience.

Please try clearing both your Joomla cache and browser cache, then test again.

If the issue persists, could you kindly provide Joomla administrator access? This will allow us to investigate the issue more thoroughly. Before sharing your credentials in hidden content, please ensure you've backed up your site using Akeeba Backup.

Thank you for your cooperation. I’ll keep you updated as soon as possible!

Best regards

0
M
Michelangelo
Accepted Answer
10 months ago #184442

Hi, and thank you for your answer. Unfortunately, I'm working on my site on a local XAMPP so I cannot provide you credentials. By the way.. I cleaned all the caches but the problem is not solved.

The css class .megamenufoniafacile .sp-dropdown-inner { background-color: #fcc200 !important; border: 2px solid #ffffff !important; left: 0px !important;}

is not loaded in any way, now also in the custom code in the template. In addition, if I change one of the three classes (for example the name of the class), the last one I modifiy works properly and one of the other two does not.

It seems to be something about a kind of priority or similar.

0
Asfakur Rahman Saikat
Asfakur Rahman Saikat
Accepted Answer
Support Agent 10 months ago #184447

Hi,

It’s possible that your CSS rule isn’t being applied due to incorrect chaining. The CSS should work both in the template’s custom code section as well as in the custom.css file.

You can test the CSS with the following rule:

* {
    background-color: red !important;
}

Could you please let me know where you found the .megamenufoniafacile class or where it’s applied? A screenshot would be helpful to better understand the issue.

Note: It's important to write the CSS rules properly to ensure the style is applied correctly.

Feel free to reach out if you have any further questions.

Best regards

0
Pavel
Pavel
Accepted Answer
10 months ago #184443

The css class .megamenufoniafacile .sp-dropdown-inner .... is not loaded in any way, now also in the custom code in the template.

Hi.

If in your Dev Tools, in the CSS window, you cannot find this element (CSS rule), it can only mean one thing: your selector is incorrect and is targeting a non-existent element, which is why it’s not there. There can be no other reason. It’s your mistake.

Without a link to your website, it’s impossible to help further.

0
Pavel
Pavel
Accepted Answer
10 months ago #184446

The selector .megamenufoniafacile does look suspicious. It’s likely that it should be either .megamenu.foniafacile (if the element has both classes) or .megamenu .foniafacile (if .foniafacile is a child element of .megamenu). Double-check your HTML structure and adjust the selector accordingly.

0
M
Michelangelo
Accepted Answer
10 months ago #184452

Hi everyone, I understand that you think it could be my mistake but, honestly, this would not explain why 2 of the 3 classes (which have the same structure) work and 1 does not. For simplicity, I will explain what I did so you can correct me if necessary.

a) in the custom.css file I created the first rule .mmfoniafacile .sp-dropdown-inner { background-color: #fcc200 !important; border: 2px solid #ffffff !important; left: 0px !important;}. Then, I inserted the mmfoniafacile class into the "custom class" of the megamenu. And everything worked

b) I repeated the same thing for the other two rules .mmavigafacile .sp-dropdown-inner { background-color: #03789E !important; border: 2px solid #ffffff !important;} and .mmassistenz .sp-dropdown-inner { background-color: #40b1e2 !important; border: 2px solid #ffffff !important;}.

So, in fact, I did nothing more than a copy and paste of the same class structure, modifying, for each one, the background color. Nothing more.

But now, of the 3 rules, 2 work and 1 doesn't.

I don't understand where my mistake is.

Maybe it's better if I tell you what I want to achieve and you give me the correct css code?

0
Asfakur Rahman Saikat
Asfakur Rahman Saikat
Accepted Answer
Support Agent 10 months ago #184453

Hi,

Thank you for your effort.

Please check the main CSS class for the rule that is not being applied.

It seems that the class you applied (possibly .mmassistenz) is not loading. Kindly provide a screenshot of the class where you inserted it and share it with us. Additionally, inspect the element in Google Chrome to verify if the class is loading correctly like this https://prnt.sc/l3HqM0FcfnRh

Compare it with a working class to identify any differences.

Hopefully, this will help you pinpoint the issue.

Best regards

0
M
Michelangelo
Accepted Answer
10 months ago #184460

Yes, the rule appears in the code but its properties are not loaded

0
Pavel
Pavel
Accepted Answer
10 months ago #184455

Use this button to provide code

Maybe it's better if I tell you what I want to achieve and you give me the correct css code?

I reproduced your steps and everything works fine.

Perhaps you make a mistake somewhere.

For example, here.

0
M
Michelangelo
Accepted Answer
10 months ago #184458

Hi, this is the code in my custom.css

.mmfoniafacile .sp-dropdown-inner { background-color: #fcc200 !important; border: 2px solid #ffffff !important; left: 0px !important;}

.mmavigafacile .sp-dropdown-inner { background-color: #03789E !important; border: 2px solid #ffffff !important;}

.mmassistenz .sp-dropdown-inner { background-color: #40b1e2 !important; border: 2px solid #ffffff !important;}

It seems similar to yours.

It also tries to insert "." before the custom class in megamenu setting but it does not work. Some other css rules goes in conflict ?? It seems strange to me

0
Pavel
Pavel
Accepted Answer
10 months ago #184462

I’m sorry, but without a link to the website, it’s impossible to figure this out. If everything is done correctly, it should work, as you could see from my previous post. I have no other ideas.

It also tries to insert "."

Just in case—this is not correct. There shouldn’t be dots there.

0
M
Michelangelo
Accepted Answer
10 months ago #184463

Hi, here it is the screenshot of all the situation. https://ibb.co/1GvgSvwJ

If you can help me at least to tell me if I've done something wrong, otherwise I'll contact you when I'll put the site online.

Thank you

0
Pavel
Pavel
Accepted Answer
10 months ago #184464

From your screenshot, everything looks correct. The only thing is that left: 0px !important doesn’t make sense in this context. However, it doesn’t affect anything.

0
M
Michelangelo
Accepted Answer
10 months ago #184468

It is exactly what I thought.

I've just done another test: I emptied all my custom.css leaving in it only

@media (min-width: 1400px) {
    .container, .container-lg, .container-md, .container-sm, .container-xl, .container-xxl {
        max-width: 1600px !important;
    }
}

.mmfoniafacile .sp-dropdown-inner { background-color: #fcc200 !important; border: 2px solid #ffffff !important;}
.mmavigafacile .sp-dropdown-inner { background-color: #03789E !important; border: 2px solid #ffffff !important;}
.mmassistenz .sp-dropdown-inner { background-color: #40b1e2 !important; border: 2px solid #ffffff !important;}

I cleared all browser cache and all work properly.

As soon as I inserted another rule in my custom.css, for example this

/* personalizzo sfondo topbar */
#sp-top-bar {background: #40B1E2; color: #FFFFFF;}
/* personalizzo sfondo topbar */


/* personalizzo testo topbar */
#sp-top-bar a { color: #FFFFFF;}
#sp-top-bar a:hover { color: #fcc200; }

.sp-contact-info li {
    display: inline-block;
    margin: 0px 10px 0px 0px;
    font-size: 100%;
    white-space: nowrap;
}
/* personalizzo testo topbar */


/* personalizzo social icons */
ul.social-icons {
    list-style: none;
    padding: 0;
    margin: 0;
    display: inline-block;
    font-size: 16px;
}
/* personalizzo social icons */

everithing has become to not work again. It seems incredible to me.

0
Pavel
Pavel
Accepted Answer
10 months ago #184471

Disable any caching and compression if they are enabled. And when working with CSS, pressing CTRL+F5 to reload the page should be programmed at the instinct level.

0
M
Michelangelo
Accepted Answer
10 months ago #184476

I always press CTRL+F5 many and many times but I did not check anything about compression. I'll check and let you know.

0
Pavel
Pavel
Accepted Answer
10 months ago #184478

It’s possible that caching is enabled on your local server.

0
M
Michelangelo
Accepted Answer
10 months ago #184482

No cache seemst to be enabled.

A stranger thing has just happened. I tried to assign to the megamenu1 the same css class (.mm-navigafacile) of the megamenu2. Result: everything works fine.

If I set to megamenu1 his "old class" mm-foniafacile the problem appears again.

0
Pavel
Pavel
Accepted Answer
10 months ago #184485

Check. This should be OFF

0
M
Michelangelo
Accepted Answer
10 months ago #184486

Already checked before you adviced it to me. It has always been off.

0
Pavel
Pavel
Accepted Answer
10 months ago #184467

The only thing I can further recommend is to change the class names to simpler ones or separate them with hyphens. It’s easy to make a typo or get confused with such names.

0
M
Michelangelo
Accepted Answer
10 months ago #184475

This is a very very useful advice that I'll certainly follow from now on.

0
Asfakur Rahman Saikat
Asfakur Rahman Saikat
Accepted Answer
Support Agent 10 months ago #184843

Hi Michelangelo,

I hope your custom CSS problem has been solved. I appreciate @Mr. Pavel for providing a helpful solution.

If you need any further assistance, feel free to ask. Also, if the solution provided has resolved the issue, you may mark the most useful answer to help others with similar queries and close the post.

Once again, thank you all for your contributions!

Best regards

0
M
Michelangelo
Accepted Answer
10 months ago #184846

Hi Asfakur,

my problem is not solved. The last problem I encountered is the following:

A stranger thing has just happened. I tried to assign to the megamenu1 the same css class (.mm-navigafacile) of the megamenu2. Result: everything works fine. If I set to megamenu1 his "old class" mm-foniafacile the problem appears again.

Pavel and I checked everything possible but did not found nor the problem, nor the solution.

0
Asfakur Rahman Saikat
Asfakur Rahman Saikat
Accepted Answer
Support Agent 10 months ago #185676

Hi Michelangelo,

If the issue is related to custom CSS, the solution provided by @Mr. Pavel should work, as he has years of experience. However, if you’d like us to investigate the problem further, you can share a full site backup in the hidden content section. For file sharing, you may use https://files.fm/.

Thanks.

0
M
Michelangelo
Accepted Answer
10 months ago #185921

I'll try again on my own by checking if there are some other rules that go in conflict (but I really really don't think it). If I don't solve it, I'll share you the site.

0
M
Michelangelo
Accepted Answer
10 months ago #186324

Hi, I sent you the link in the hidden content. Thank you.

0
Asfakur Rahman Saikat
Asfakur Rahman Saikat
Accepted Answer
Support Agent 10 months ago #186384

Hi Michelangelo,

Thank you for sharing.

Could you briefly explain your current issue and provide a screenshot? Since several days have passed and this relates to custom CSS, having this information will help me investigate further.

I appreciate your understanding.

Best regards

0
M
Michelangelo
Accepted Answer
10 months ago #186399

Hi, the problem is the following. In custom.css I have those three classes

.mm-foniafacile .sp-dropdown-inner { background-color: #fcc200 !important; border: 2px solid #ffffff !important;}
.mm-navigafacile .sp-dropdown-inner { background-color: #03789E !important; border: 2px solid #ffffff !important;}
.mm-assistenza .sp-dropdown-inner { background-color: #40b1e2 !important; border: 2px solid #ffffff !important;}

those classes should work so that:

  • if I hover on "NavigaFacile" menu item, the megamenu should follow mm-navigafacile .sp-dropdown-inner classes and background-color is correctly #03789E
  • if I hover on "Assistenza" menu item, the megamenu should follow mm-assistenza .sp-dropdown-inner classes and background-color is correctly #40b1e2
  • if I hover on "FoniaFacile" menu item, the megamenu should follow mm-foniafacile .sp-dropdown-inner classes and background-color is not #fcc200

I have checked the rules so many times and there's another strange thing: in the MegaMenu setting in the template, for the item "FoniaFacile" mm-foniafacile class does not work (the background color is not #fcc200) but mm-navigafacile does work (the background color is not #03789E). How can it be that?

0
Atick Eashrak Shuvo
Atick Eashrak Shuvo
Accepted Answer
Support Agent 10 months ago #186542

Apologies for the inconvenience you’ve encountered. As my colleague @Saikat is currently on leave, I’ve taken it upon myself to investigate the issue and provide you with an update.

After reviewing the backup of your website in my local environment, I’ve identified that the issue stems from incorrect commenting in the custom.css file . Proper commenting is crucial for CSS code to function as expected, and this might have led to the issues you’re facing. I recommend correcting the comments in this file, and I believe this will resolve the problem.

Once you’ve made the necessary changes, I suggest testing the website to confirm the issue is resolved. If the problem persists or if you encounter any other difficulties, please don’t hesitate to reach out to me. I’ll be happy to assist you further to ensure everything runs smoothly.

Thank you for your patience and understanding.

Best regards

0
M
Michelangelo
Accepted Answer
10 months ago #186550

I apologize for the mistake so trivial and that I had absolutely not considered. By modifying the comments I solved everything. The small consolation is that I had not compiled the code badly :-)

Thank you for the support

0
Atick Eashrak Shuvo
Atick Eashrak Shuvo
Accepted Answer
Support Agent 10 months ago #186552

No problem at all! I'm glad to hear that modifying the comments resolved the issue. It's always a good sign when the core code was correctly written. If you need any further assistance, feel free to reach out. Please marked the issue as solved.

0