Custom CSS not working, even with !important


I want to change the 'top' and 'right' values for the below CSS. In the element inspector, it says the CSS is found within index.php rather than any CSS file, but there's nothing in the index.php file when I search for '#Top_Bar' . I've tried using !important in the custom CSS, but that didn't work.

@media only screen and (max-width: 959px)
#Top_bar a.responsive-menu-toggle {
    top: 28px;
    right: 10px;
}

@media only screen and (max-width: 959px)
#Top_bar a.responsive-menu-toggle i {
    font-size: 30px;
}

I also need to change the above top/right values when the screen size drops below 768px, but even with !important added to the custom CSS in BeTheme Options, it is not supplanting the code coming from index.php.

Comments

  • Hi,

    css's are not in index.php file. The inspector says like that because css is loaded directly in the code, not in file. So if you want to edit those css's, you can type your own code under Theme options > Custom CSS & JS > Custom CSS section and your code will overwrite the default one.

    Thanks!
  • Hi there,

    As I tried to explain in my original post, I have tried several times to use the custom CSS to override these styles, but it does not affect the CSS that is loaded directly.

    Can you explain why, for example, the following code wouldn't work to change the position of the mobile menu toggle in the main nav when the window is below 959px (even with !important)? This is exactly how I have been able to change the menu toggle in Chrome's element inspector but when it comes to the custom CSS it doesn't want to work.

    @media only screen and (max-width: 959px)
    #Top_bar a.responsive-menu-toggle {
        top: 40px!important;
        right: 40px!important;
    }


  • It's very simple, above code is wrong. There should be brackets before css which is inside and after so the whole code supposed to look like as:
    @media only screen and (max-width: 959px) {
        #Top_bar a.responsive-menu-toggle {
            top: 40px!important;
            right: 40px!important;
        }
    }
    If you don't know how @media rules works, we suggest to check it on http://www.w3schools.com/cssref/css3_pr_mediaquery.asp
  • Actually, it makes total sense. I just copied the CSS directly from Chrome's element inspector and thus it didn't copy the curly brackets. Silly mistake, so thank you for pointing it out!
Sign In or Register to comment.
This website uses cookies

We use cookies to personalise content and ads, to provide social media features and to analyse our traffic. We also share information about your use of our site with our social media, advertising and analytics partners who may combine it with other information that you’ve provided to them or that they’ve collected from your use of their services.

Cookies are small text files that can be used by websites to make a user's experience more efficient.

The law states that we can store cookies on your device if they are strictly necessary for the operation of this site. For all other types of cookies we need your permission. This means that cookies which are categorized as necessary, are processed based on GDPR Art. 6 (1) (f). All other cookies, meaning those from the categories preferences and marketing, are processed based on GDPR Art. 6 (1) (a) GDPR.

This site uses different types of cookies. Some cookies are placed by third party services that appear on our pages.

You can at any time change or withdraw your consent from the Cookie Declaration on our website.

Learn more about who we are, how you can contact us and how we process personal data in our Privacy Policy.

Please state your consent ID and date when you contact us regarding your consent.