I'm trying to recreate this component that consists of a button on the far right corner and a label that shows the name of file.

In order to get that result, I'm using absolute position for the button, but you can easily tell that the button is inside its parent and not on top of it
HTML:
<div class="ctrl">
<div class="upload">
<label class="upload__file-name">Select a file</label>
<button type="button" class="upload__choose">
Browse
</button>
</div>
</div>
SCSS:
*,
*::after,
*::before {
margin: 0;
padding: 0;
box-sizing: inherit;
}
html {
height: 100%;
font-size: 62.5%; //1 rem = 10px; 10px/16px = 62.5%
background-color: #562765;
}
body {
box-sizing: border-box;
height: 100%;
}
.file-input {
display: none;
}
.ctrl {
height: 4.8rem;
}
.upload {
height: 100%;
width: 100%;
background-color: rgba(#F0F0F0, 0.32);
border: 1px solid #fff;
box-sizing: border-box;
border-radius: 40px;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 0 0 23px;
position: relative;
&__file-name {
display: inline-block;
font-size: 1.4rem;
font-weight: bold;
line-height: 120%;
color: rgba(#fff, 0.48);
}
&__choose {
top: 0;
right: 0;
position: absolute;
cursor: pointer;
border: 0;
height: 100%;
color: #fff;
display: flex;
justify-content: center;
align-items: center;
padding: 12px 40px;
background: linear-gradient(
100.77deg,
rgba(222, 102, 251, 0.4) 0%,
rgba(222, 102, 251, 0) 53.8%
),
#7036e9;
box-shadow: 0px 1px 24px -1px rgba(13, 8, 70, 0.4);
backdrop-filter: blur(20px);
border-radius: 40px;
}
}
Here's a codepen with the HTML + CSS (Sass) I used.
Is there any way I can make the button look like as it were placed on top of its container? In other words, how can I align the button's top, right, and bottom borders with its parent container?
Thanks.
