<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Scroll to Bottom of Div</title>
<link rel="stylesheet" href=
<style>
body {
font-family: Arial, sans-serif;
background-color: #f8f9fa;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
#scrollableDiv {
width: 100%;
height: 200px;
overflow-y: scroll;
border: 1px solid #dee2e6;
background-color: #fff;
padding: 10px;
border-radius: 0.25rem;
box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}
p {
margin: 0 0 10px 0;
}
.scrollBtn {
border-radius: 0.25rem;
}
h2 {
text-align: center;
color: #2e8c46;
}
</style>
</head>
<body>
<div class="container">
<div class="row justify-content-center">
<div class="col-md-6">
<div id="scrollableDiv">
<h2>Geeks for Geeks</h2>
<p>
GeeksforGeeks is a computer science
portal for geeks.It contains
well-written, well-thought,and
well-explainedcomputer science and
programming articles, quizzes, and
practice/competitive programming/company
interview Questions.
</p>
<p>
GeeksforGeeks has grown tremendously
since its inception in 2009
and now has over 2 million registered users and
over 10 million page views per month.
</p>
<p>
The website covers topics ranging from algorithms,
data structures, programming languages,
software development, to interview preparation
for various tech companies.
</p>
<p>
GeeksforGeeks also provides a platform for
users to practice coding through its coding
practice section and participate in coding
contests.
</p>
<p>Overall, GeeksforGeeks is a valuable resource for
computer science enthusiasts, students, and
professionals seeking to enhance their knowledge
and skills in the field of computer science
and programming.
</p>
</div>
<button class="btn btn-primary btn-block mt-3 scrollBtn"
onclick="scrollToBottom()">Scroll to
Bottom</button>
</div>
</div>
</div>
<script>
// Get the scrollable div element
var scrollableDiv = document.
getElementById('scrollableDiv');
// Function to scroll to the bottom
//of the div using scrollIntoView method
function scrollToBottom() {
var bottomElement = scrollableDiv.
lastElementChild;
bottomElement
.scrollIntoView({ behavior: 'smooth', block: 'end' });
}
</script>
</body>
</html>