JSFiddle - React, Tailwind, and code Playground
HTML
<div id="scrollable">
<div id="centered">
</div>
</div>
<div>
<button id="scale3" type="button">
Scale 3
</button>
<button id="scale05" type="button">
Scale 0.5
</button>
</div>
CSS
#centered {
background-image: linear-gradient(to bottom,yellow,red);
height: 200px;
transform: scale(1);
transition: transform 1s ease-out;
width: 200px;
}
#scrollable {
align-items: center;
border: 1px solid red;
display: flex;
height: 300px;
justify-content: center;
overflow: auto;
width: 300px;
}
JavaScript
$('#scale3').on('click', function () {
$('#centered').css({transform: 'scale(3)'});
});
$('#scale05').on('click', function () {
$('#centered').css({transform: 'scale(0.5)'});
});