1

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;
}

3 Answers 3

6

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.

Sign up to request clarification or add additional context in comments.

3 Comments

Can anyone explain how inline styles are created in wordpress and how can I modify directly without using the above method. Is it possible?
Where to add that JS statement, i mean in which php file? (I'm new to wordpress)
@DeebashVFX I don't know WP too, but you must put that to .js file
0

Use following code it will work for both cases if you have one or both classes on div tag.

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

Comments

0

Justinas explains it well and that should work perfectly, I have applied the same to custom CSS of a WordPress theme and has worked for me. The CSS I had trouble changing were inline a div.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.