CSS Scroll Smooth

CSS Smooth Scrool, In this article we will do smooth scroll with vanilla CSS without JavaScript and jQuery.

CSS Smooth Scroll

logically if you think that smooth scroll is not possible with vanilla CSS, but we can do smooth CSS scroll and it's possible. smooth CSS scroll means if we move from one section to another section that the moving action will be smooth. so will do a simple example in this article we are going to create just four HTML sections, and we will move from one section to another section. 
css scroll
css scroll



<!DOCTYPE html>
<html lang="en">
<head>
 <meta charset="UTF-8">
 <title>Smooth Scroll</title>
 <link rel="stylesheet" href="style.css">
</head>
<body>
 
   
   <div class="container">
    <nav>
     <ul>
      <li><a href="#home">Home</a></li>
      <li><a href="#services">Services</a></li>
      <li><a href="#contact">Conctact</a></li>
      <li><a href="#about">About</a></li>
     </ul>
    </nav>

   <section id="home">
    <h1>Home</h1>
   </section>

   <section id="services">
    <h1>Services</h1>
   </section>

   <section id="contact">
    <h1>Contact</h1>
   </section>

   <section id="about">
    <h1>About</h1>
   </section>

   </div>


</body>
</html>

* {

   margin: 0;
   padding: 0;
   box-sizing: border-box;

}

body {
 font-family: sans-serif;
 height: 100vh;
}

.container {
 width: 100%;
 height: 100%;
 overflow-y: scroll;
 scroll-behavior: smooth;
}

nav {
 width: 100%;
 height: 65px;
 line-height: 65px;
 background-color: #fff;
 position: fixed;
 top: 0;
 left: 0;
}

nav ul {
 list-style: none;
 margin: 0 30px;
}

nav ul li {
 display: inline-block;
}

nav ul li a {
 display: block;
 text-decoration: none;
 color: #222;
 padding: 0 20px;
}

section {
 width: 100%;
 height: 100vh;
 display: flex;
 justify-content: center;
 align-items: center;
 color: #fff;
}

h1 {
 font-size: 60px;
 letter-spacing: 2px;
}

section#home {
 background-color: #F36;
}

section#services {
 background-color: #F60CCD;
}

section#contact {
 background-color: #1857F8;
}

section#about {
 background-color: #FDDC00
}

COMMENTS

Name

ajax,2,HTML & CSS,19,JavaScript,1,PHP,11,
ltr
item
webtipstricks: CSS Scroll Smooth
CSS Scroll Smooth
CSS Smooth Scrool, In this article we will do smooth scroll with vanilla CSS without JavaScript and jQuery.
https://1.bp.blogspot.com/-DUPMiYChZWE/XPUDKZP5JZI/AAAAAAAAB5w/L1ZFJ4xWGRoRuQnDuX8n3URzkm2nUSENwCLcBGAs/s640/SCROLL-min.png
https://1.bp.blogspot.com/-DUPMiYChZWE/XPUDKZP5JZI/AAAAAAAAB5w/L1ZFJ4xWGRoRuQnDuX8n3URzkm2nUSENwCLcBGAs/s72-c/SCROLL-min.png
webtipstricks
https://www.webtipstricks.com/2019/06/css-scroll-smooth.html
https://www.webtipstricks.com/
https://www.webtipstricks.com/
https://www.webtipstricks.com/2019/06/css-scroll-smooth.html
true
4027471107773963481
UTF-8
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS CONTENT IS PREMIUM Please share to unlock Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy