Deekshith S
Deekshith S

Reputation: 281

How to write plugin CSS that override theme CSS

I wrote CSS for my plugin, but theme CSS overwriting that, I have tried and searched for this I did not get any solution

This is my HTML code

 <html>
 <body>
 <img src="sample.gif" width="100" height="132">
 <h1>This is also some text. This is also some text. This is also some text. This is also some text. This is also some text. This is also some text.</h1>
 </body>
 </html>

my CSS is

 img {
       float: right !important;
     }

And theme CSS is

  h1 {
       clear:both;
     }

I want my image to be displayed to the right side of h1 tag.

Upvotes: 2

Views: 52

Answers (1)

mayersdesign
mayersdesign

Reputation: 5310

Simply remove the clear on the title... if that's not possible, override it

img {
  float: right
}

h1 {
  clear: both !important
}

body h1 {
  clear: none !important
}
<img src="sample.gif" width="100" height="132">
<h1>This is also some text. This is also some text. This is also some text. This is also some text. This is also some text. This is also some text.</h1>

Upvotes: 3

Related Questions