Suppose I have an HTML structure like this and I need to create a button for scrolling using scrollTo
. However, I've come across the information that scrollTo doesn't work well with height: 100vh
and overflow: auto
.
What would be the best way to handle this situation?
NOTE: Just to mention, I am working on Reactjs, and my code in JSX
file closely resembles the HTML setup below:
.big-container {
height: 100vh
}
.small-container {
overflow: auto;
height: calc(100vh-300px)
}
.smaller-container {
overflow: auto
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.6.3/umd/react.production.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.6.3/umd/react-dom.production.min.js"></script>
<!DOCTYPE html>
<html lang="en">
<body>
<div class="big-container">
<div class="small-container">
<div class="smaller-container">
<p>paragraphs here</p>
</div>
</div>
</div>
</body>
</html>