I changed left to right and it will not give whitespaces from the left side when I resize the browser.
&__container {
position: absolute;
display: block;
right: 160px; //i changed this
width: 640px;
max-width: 100%;
height: 100%;
@include sp {
right: 0;
margin-top: getsp375(57px);
width: 100%;
height: auto;
}
}
Did I mess up with the containers? I have two containers. One is the main and the second is the container for the text. What I meant is when I resize the browser the container of the text is overflowing and creating spaces for the side.
This is my codepen: https://codepen.io/pen/WNGLqdd

My codes in scss
.banner {
position: relative;
display: flex;
margin: 80px auto;
@include sp {
margin: getsp375(80px) auto;
}
&__img {
display: block;
width: 100%;
height: 360px;
@include sp {
display: none;
}
&--sp {
display: none;
@include sp {
display: block;
width: 100%;
height: auto;
}
}
}
&__text {
display: flex;
justify-content: center;
align-items: center;
font-size: 36px;
font-weight: $medium;
text-align: center;
@include sp {
font-size: getps375(54px);
font-weight: $regular;
line-height: 1.3em;
margin-left: getsp375(30px);
margin-right: getsp375(30px);
}
&--small {
font-size: 28px;
@include sp {
font-size: getsp375(42px);
}
}
&--extra-small {
position: absolute;
top: -34px;
left: 245px;
font-size: 13px;
line-height: 4.62em;
@include sp {
top: getps375(23px);
left: getsp375(284px);
font-size: getsp375(20px);
line-height: 4.5em;
}
}
&--description {
padding-top: 25px;
font-size: 16px;
@include sp {
line-height: auto;
padding-top: getsp375(40px);
font-size: getsp375(28px);
font-weight: $regular;
}
}
&--title {
font-size: 50px;
font-family: $nunito;
font-weight: $bold;
line-height: 0.83em;
@include sp {
font-size: getsp375(74px);
line-height: 1.22em;
}
&::after {
content: 'さん';
font-weight: $medium;
}
}
}
&__container {
position: absolute;
display: block;
left: 643px;
width: 640px;
max-width: 100%;
height: 100%;
@include sp {
left: 0;
margin-top: getsp375(57px);
width: 100%;
height: auto;
}
}
&__text-container {
position: relative;
margin-top: 94px;
width: 640px;
max-width: 100%;
@include sp {
margin-top: 0;
width: 100%;
}
&--second {
margin-top: 124px;
left: 30px;
@include sp {
margin-top: getsp375(125px);
left: 0;
}
}
}
&__button-container {
position: relative;
display: flex;
justify-content: center;
align-items: center;
text-align: center;
width: 100%;
margin-top: 20px;
margin-bottom: 60px;
@include sp {
margin-bottom: 0;
margin-top: getsp375(138px);
}
&--second {
@include sp {
margin-bottom: 0;
margin-top: getsp375(91px);
}
}
}
&__arc-container {
margin-top: 36px;
margin-left: 104px;
width: 94.4%;
@include sp {
margin-top: 0;
margin-left: 0;
}
}
&__arc {
background-repeat: no-repeat;
position: absolute;
width: 470px;
height: 81px;
@include sp {
width: 100%;
padding: 0 getsp375(21px);
height: auto;
}
}
}
My codes in PUG
section.banner
img.banner__img(src="./img/banner__img1.jpg", alt="Banner 1")
img.banner__img.banner__img--sp(src="./img/banner__img1-sp.jpg", alt="Banner 1")
div.banner__container
div.banner__text-container
h1.banner__text.banner__text--small イベント企画‧まちづくりの⽅へ
h1.banner__text ファンワッカがお⼿伝いします!
p.banner__text.banner__text--description これはダミー文字です新型コロナウイルス緊急事態宣言解除後の当社対応についてのお知らせ 染まってないからこそ、新たな風を吹き込めるリアルをコアとした体験を
div.banner__button-container
a.button(href="#") 詳しく見る