Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove specific rules from tailwind base

Tags:

tailwind-css

I want to remove the img rule from tailwind base, is there anyway to do that?

Tailwind base adds this:

img, video {
    max-width: 100%;
    height: auto;
}

I want to remove that rule. Overrideing it with initial will not get my expected result.

So unfortunately i cannot do:

img, video {
    max-width: initial;
    height: initial;
}

height: initial doesnt seems to be the same as having no height attribute at all. If i override height to initial the height will be the source of the image and height attributes on the <img height="200"> will not be respected.

like image 594
user3711421 Avatar asked Sep 11 '25 23:09

user3711421


1 Answers

Yes, it's

As the documentation says, you can override the base properties by using @layer base.

It's available from v1.9.0.

@tailwind base;
@tailwind components;
@tailwind utilities;

@layer base {
  img, video {
    max-width: initial;
    height: initial;
  }
}

like image 141
Vinicius Cainelli Avatar answered Sep 14 '25 13:09

Vinicius Cainelli



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!