Для достижения этой цели можно использовать фоновую окраску:
.box {
padding:5px;
border-right:100px solid transparent; /* The same as the width of the line */
background:
/*the borders*/
linear-gradient(red,red) top /100% 2px padding-box,
linear-gradient(red,red) bottom/100% 2px padding-box,
linear-gradient(red,red) left /2px 100% padding-box,
linear-gradient(red,red) right /2px 100% padding-box,
/*the dashed line*/
repeating-linear-gradient(to right,red 0px 3px,transparent 3px 5px) right center/100px 2px border-box;
background-repeat:no-repeat;
max-width:250px;
margin:10px;
display:inline-block;
}
<div class="box">
Some text here
</div>
<br>
<div class="box">
Some long long text here with some wrapping
</div>