CSS HTML Scroll Behavior Smooth Section Click
➤ CSS (Cascading Style Sheets)
<style>
html {
scroll-behavior: smooth;
}
#section1 {
height: 600px;
background-color: green;
text-align:center;
}
#section2 {
height: 600px;
background-color: red;
text-align:center;
}
</style>
➤ HTML Code
<div class="main" id="section1">
<a href="#section2">go to Section 2</a>
</div>
<div class="main" id="section2">
<a href="#section1">go to Section 1</a>
</div>
ความคิดเห็น
แสดงความคิดเห็น