Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to make child element not effected by parent element transform

I have a parent div that is a tilted box using skew transform. And I also have a child element contains text, but it also get tilted. I tried doing transform: none for the child but it didn’t work. (Using svelte)

<div class="tilt">
    <p class="remove-tilt">Hello</p>
</div>

<style>
    .tilt {
        transform: skew(-5deg);
    }

    .remove-tilt {
        transform: none;
    }
</style>

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Neutralize the transformation:

.remove-tilt {

   transform: skew(5deg);

}

It’s probably best to target each element with better selectors.

div .tilt:not(p) {

   transform: skew(-5deg);

}
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading