user3711421
user3711421

Reputation: 1808

Remove specific rules from tailwind base

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.

Upvotes: 4

Views: 3084

Answers (1)

Vinicius Cainelli
Vinicius Cainelli

Reputation: 974

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

Upvotes: 4

Related Questions