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.