Search code examples
csswordpressstylesheetinlineelement

Overriding Inline css of wordpress template


I want to override the style padding-top:100px to padding-top:0px. How can i override the inline style inside wordpress template?

<!-- Sidebar With Content Section-->
    <div class="with-sidebar-wrapper">
  <section id="content-section-1" >
  <div class="gdlr-full-size-wrapper gdlr-show-all"  style="padding-top: 100px; padding-bottom: 0px;  background-color: #ffffff; "  ><div class="gdlr-master-slider-item gdlr-slider-item gdlr-item"  style="margin-bottom: 0px;"  >
    <!-- MasterSlider -->

I already tried the below code in style.css but its not working!

.gdlr-full-size-wrapper .gdlr-show-all{
padding-top:0px !important;
}

Solution

  • To select this perticular <div> you to write your CSS like:

     .gdlr-full-size-wrapper.gdlr-show-all {
    
     } /*without space between*/
    

    you're using

     .gdlr-full-size-wrapper .gdlr-show-all {
    
     }
    

    viz selecting

    <div class="gdlr-full-size-wrapper">
       <div class="gdlr-show-all"></div>
    </div>
    

    Also if you're willing to override inline CSS only then you can use [style] selector also.

    As:

    <div class="someClass" style="font-size:10px; "></div>
    

    So we can write CSS like:

    .someClass[style] { font-size:14px !important}
    

    what's trick here is this CSS only works when someClass has inline CSS for font.