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

Remove background outline on the side of the border after skew transform

Here is my markup:

<div class="labels">
   <p>Very Funny</p>
</div>

Here is my CSS:

div.labels p {
  background: red;
  border-left: 2rem solid white;
  border-right: 2rem solid white;
  color: white;
  font-family: 'Bebas Neue';
  text-transform: uppercase;
  line-height: 0.8;
  transition: 0.4s ease all;
  font-size: 4rem;
  -webkit-text-stroke: 2px white;
  letter-spacing: 2px;
  width: fit-content;
  padding: 1rem 2rem;
  transform: skew(-10deg);
}

Here is the demo: https://jsfiddle.net/90vLp4ub/

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

You will notice that there is a thin red line around the element due to the background. How can I get rid of that?

Thanks.

>Solution :

To remove the red outlines and keep the animation, you can do this:

  1. Remove the borders left and right from p:hover
  2. Add some margin-left
div.labels p:hover {
  background: red !important;
  margin-left: 30px;
}
div.labels p {
  color: white;
  font-family: 'Bebas Neue';
  text-transform: uppercase;
  line-height: 0.8;
  transition: 0.4s ease all;
  font-size: 4rem;
  -webkit-text-stroke: 2px white;
  letter-spacing: 2px;
  width: fit-content;
  padding: 1rem 2rem;
  transform: skew(-10deg);
}
<div class="labels">
   <p>Very Funny</p>
</div>
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