-1

I was wondering how can I get this shape when the current page is displayed
enter image description here

My current code goes like this:

current {
  transform: skew(-20deg);
  border: 1px solid white;
  color: black;
  background-color: white;
}

But text goes sideways aswell

enter image description here

johannchopin
  • 13,720
  • 10
  • 55
  • 101
шоӍи
  • 9
  • 2

2 Answers2

3

If you apply the opposite skew on an inner element, then the text will become unskewed.

.current {
  transform: skew(-20deg);
  border: 1px solid white;
  color: black;
  background-color: white;
  width: 60px;
  text-align: center;
  padding: 5px;
}

.text {
  transform: skew(20deg);
}

body {
  background: #000;
}
<div class="current">
  <div class="text">Text</div>
</div>
dantheman
  • 3,189
  • 2
  • 10
  • 18
3

try this:

.box{
display: inline-block;
padding: 12px 64px;
background-color: #000;
color: #fff;
clip-path: polygon(25% 0%, 100% 0%, 75% 100%, 0% 100%);
}
<div class="box">text</div>
Ehsan
  • 766
  • 10
  • 17
  • 1
    those 2 links can be useful to your answer : https://developer.mozilla.org/en-US/docs/Web/CSS/clip-path & https://bennettfeely.com/clippy/ – G-Cyrillus Aug 31 '20 at 17:45