skip to Main Content

enter image description here

I’ve to remove the inline style of of the div element, can anybody tell me how to select that particular div, I’ve tried selecting class but inline style has more priority than class selector. Please tell me how to remove the inline style from it, I’m using WordPress and it is theme generated css.

2

Answers


  1. Please try this –

    .col-inner .img a.image-lightbox .img-inner.img-cover{padding: top: 77% !important;margin: 0 !important;}
    
    Login or Signup to reply.
  2. This is one of those just because you can doesn’t mean you should moments. Ideally, you should make a child theme and make your updates there. You can find plenty of help on how to make child themes in the WordPress docs.

    That said, it is possible, but it’s not best practice. This code will override what is in your current inline style.

    /* this select a div with the class img-inner with the style attribute */
    div.img-inner[style] {
      margin: 2rem !important; /* anything you need to override needs an !important */
      padding: 0 !important;
    }
    

    Once you have the div selected, you can pretty much do what you need. I just put in some declarations as an example. You can add more declarations or override/unset others.

    If you need, you can use a more complex attribute selector to see if the style contains something specific.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search