Так что это можно сделать с помощью background-clip: text
- хотя это не поддерживается повсеместно, оно работает в последних версиях Chrome, Firefox и Edge:
.container {
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
}
.rotate {
border: 1px solid #ddd;
text-align: center;
background: linear-gradient(75deg, #adf175 50%, transparent 50%);
transform: rotate(-90deg);
}
.text {
font-family: arial, sans-serif;
font-size: 1.5em;
font-weight: bold;
padding: 5px;
margin: 0;
text-transform: uppercase;
background: linear-gradient(75deg, #fff 50%, #adf175 50%);
color: transparent;
-webkit-background-clip: text;
-moz-background-clip: text;
background-clip: text;
}
.fit-text {
font-size: 2.25rem;
}
<div class="container">
<div class="rotate">
<div class="text">we are on a
<div class="fit-text">mission</div>
</div>
</div>
<div class="rotate">
<div class="text">we are on a<br/>mission</div>
</div>
</div>
Это решение включает в себя поворот результата и расширение последнего слова, чтобы соответствовать (как выглядит ваш пример изображения) - я также включил нерасширенную версию.