I am trying to create a rectangle with partial borders with rounded caps. Like the image below:
I have come this far to remove a part of the border. But I can't think of an easy way to get the result in the picture:
body {
position: relative;
}
div.inner {
position: absolute;
top: 10px;
left: 10px;
display: inline-block;
width: 420px;
height: 320px;
background-color: #f80;
border-radius: 40px;
}
div.border {
position: absolute;
display: inline-block;
width: 400px;
height: 300px;
background-color: transparent;
border-radius: 40px;
border: 20px solid black;
clip-path: polygon(0% 0%, 0% 100%, 100% 100%, 100% 0%, 60% 0%, 60% 75%, 25% 75%, 25% 0%);
}
<body>
<div class="inner"></div>
<div class="border"></div>
</body>

Here is an idea using one element. It may look complex but all you have to do is to adjust the CSS variables