Как сделать фигурное выделение текста

Подскажите, как правильно прописать код, чтобы получилось так как на картинке. Я не верстальщик, но очень нужно сделать


Ответы (5 шт):

Автор решения: Alex Smit

Можно загрузить картинку фоном, например: css: background: url(../img/fon.png) no-repeat center center;

→ Ссылка
Автор решения: Евгений Иванов

Вот так например

.bage {
    position: relative;
    display: inline-block;
    color: #fff;
    background-color: red;
    padding: 5px 6px 5px 10px;
    transform: skewX(-20deg)
}

.bage:after, .bage:before {
    content: "";
    position: absolute;
    border: 17px solid transparent;
    transform: skewX(20deg);
    right: -14px;
    z-index: -1
}

.bage:before {
    top: 0;
    border-top-color: red
}

.bage:after {
    bottom: 0;
    border-bottom-color: red
}

.bage__text {
    position: relative;
    font-weight: 600;
    display: inline-block;
    transform: skewX(20deg)
}
<span class="bage">
    <span class="bage__text">789 руб</span>
</span>

→ Ссылка
Автор решения: Qwertiy

div {
  display: inline-block;
  padding: 0 1em;
  background: red;
  background-clip: content-box;
  color: white;
}

div::before, div::after {
  content: "";
  display: inline-block;
  vertical-align: middle;
  border-style: solid;
}

div::before {
  border-width: 2em 1em 0 0;
  border-color: transparent red transparent transparent;
  margin-left: -1em;
}

div::after {
  border-width: 1em 1em 1em 0;
  border-color: red transparent red red;
  margin-right: -1em;
}
<div> 789 руб </div>

→ Ссылка
Автор решения: Sevastopol'

Ещё проще:

div {
  display: table; background: red; color: white; margin: 5px; padding: 7px 30px;
  clip-path: polygon(20px 0, 100% 0, calc(100% - 20px) 50%, 100% 100%, 0% 100%);
}
<div>789 789 789 789 789 руб</div><div>789 789 789 789 руб</div><div>789 789 789 руб</div><div>789 789 руб</div><div>789 руб</div><div>7 руб</div><div>7</div>

→ Ссылка
Автор решения: MaximLensky

linear-gradient пример

div{
  background: linear-gradient(45deg, tomato 70%,transparent 30%),
              linear-gradient(135deg, tomato 70%,transparent 30%);
  display: inline-block;
  padding: 10px 90px 10px 10px;
  margin: 10px 20px;
  position: relative;
}

div:before{
  content: "";
  position: absolute;
  left: -20px;
  top: 0;
  width: 20px;
  height: 100%;
  background: linear-gradient(-80deg, tomato 70%, transparent 0%);
}
<div>789789 руб</div>
<div>78999999руб</div>
<div>78999999999руб</div>
<div>78999999999999999 руб </div>

Пример на transform: matrix

.price{
  padding: 10px 20px 10px 0;
  position: relative;
  display: inline-block;
  margin: 30px;
}

.price:before{
  content: "";
  display: block;
  width: 30px;
  height: 100%;
  position: absolute;
  left: -30px;
  top: 0;
  background: lightgreen;
  z-index: 10;
  transform: matrix(1,0,-0.5,1,1,0);
}

.text{
  position: relative;
  z-index: 100;
}

.minusmatrix,.plusmatrix{
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
}

.minusmatrix{
  background: lightgreen;
  transform: matrix(1,0,0.5,1,0,0);
}
.plusmatrix{
  background: lightgreen;
  transform: matrix(1,0,-0.5,1,0,0);
}
<div class="price">
  <div class="minusmatrix"></div>
  <div class="plusmatrix"></div>
  <div class="text">999 руб</div>
</div>

<div class="price">
  <div class="minusmatrix"></div>
  <div class="plusmatrix"></div>
  <div class="text">9999 руб</div>
</div>

<div class="price">
  <div class="minusmatrix"></div>
  <div class="plusmatrix"></div>
  <div class="text">99999 руб</div>
</div>

<div class="price">
  <div class="minusmatrix"></div>
  <div class="plusmatrix"></div>
  <div class="text">9999999999 руб</div>
</div>

→ Ссылка