Support » Fixing WordPress » How to disable WordPress to load widget style css.

  • Resolved Mebahel

    (@mebahel)


    Hello,

    I just started to create firs website, a lot of things I do by myself but I’m very new with that.

    I just created a widget, custom HTML which uses custom CSS and js. I created a separate folder for bot files, unfortunately as I realized WordPress website started to use css which I created just por widget.

    Should I use custom tag different than h1,p,button or is there any other way to make wordpress do not use css for my widget.

    Thank you for all help. I know that buttos are to big etc. I will fix it, this is my main problem now.

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi

    Please have a unique class or ID on the parent element and then use them like the following:

    .your_parent_class h1{
    // Your CSS rules here
    }
    #your_parent_id h1{
    // Your CSS rules here
    }
    

    Because of the unique class/id now the CSS will apply only to the child elements of that parent and nowhere else. If you write only h1{} that means it will apply to all the h1s.

    I hope this will help you.

    Kind Regards

    Are you doing anything to load your CSS and JS? If not, they are not loaded. That’s why most widgets are plugins, so they can load the files needed, only when they are needed.
    You could put your CSS and JS into a plugin like https://wordpress.org/plugins/custom-css-js/ so you don’t have to write your own plugin to load it.

    Thread Starter Mebahel

    (@mebahel)

    Thank you parent class and parent id, It took me 15 minutes to understand but I did it. It is working now.

    • This reply was modified 1 year, 3 months ago by Mebahel.
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to disable WordPress to load widget style css.’ is closed to new replies.