Rotating Navigation using HTML, CSS, and JS

Hey, learner today In this Written tutorial, we are going to Create Rotating Navigation using HTML, CSS, and JS. In the past post, we have created many projects one of them Progress Steps Bar using HTML, CSS, and JS. Now it is time to create Rotating Navigation Animation.

Rotating Navigation using HTML, CSS, and JS

At first, we have to create a div with a Class container inside the container and create a div with the circle-container for the icon button to navigate the menu then create a div with class content to add content related to your menu. at the last, you have to create a nav element to add list items that all.

Sometimes you just want your website navigation to be the best and bold. animated elements are the key ingredients of the user experience. In this case, a rotating navigation bar menu can’t just be fun. It has to be efficient.

Preview of Rotating Navigation on Codepen

See the Pen
Rotating Navbar using HTML, CSS and JS
by Coding thai (@Codingthai)
on CodePen.

Codepen Link

You might like this

Rotating Navigation using HTML, CSS and JS [Source code]

To create Rotating Navigation using HTML, CSS, and JS you have to create three files (HTML, CSS, and JS) files with the named index.html, style.css, and Script.js in the same folder and you have to link the CSS and JS file to HTML. after that paste, the HTML code in index.html, and paste the CSS code in style.css at last paste the Javascript code in Script.js that’s all after pasting the code.

At first, you have to create an HTML file with the named index.html and paste the below HTML code on it and save it. Remember to give a .html extension to the HTML file.

<!DOCTYPE html>
<html lang="en">
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <link rel="stylesheet" href="" integrity="sha512-1PKOgIY59xJ8Co8+NE6FZ+LOAZKjy+KY8iq0G4B3CyeY6wYHN3yt9PW0XpSriVlkMXe40PTKnXrLnZ9+fkDaog==" crossorigin="anonymous" />
    <link rel="stylesheet" href="style.css" />
    <title>Rotating Navigation</title>
    <div class="container">
      <div class="circle-container">
        <div class="circle">
          <button id="close">
            <i class="fas fa-times"></i>
          <button id="open">
            <i class="fas fa-bars"></i>

      <div class="content">
        <h1>Amazing Article</h1>
        <small>Florin Pop</small>
        <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Accusantium quia in ratione dolores cupiditate, maxime aliquid impedit dolorem nam dolor omnis atque fuga labore modi veritatis porro laborum minus, illo, maiores recusandae cumque ipsa quos. Tenetur, consequuntur mollitia labore pariatur sunt quia harum aut. Eum maxime dolorem provident natus veritatis molestiae cumque quod voluptates ab non, tempore cupiditate? Voluptatem, molestias culpa. Corrupti, laudantium iure aliquam rerum sint nam quas dolor dignissimos in error placeat quae temporibus minus optio eum soluta cupiditate! Cupiditate saepe voluptates laudantium. Ducimus consequuntur perferendis consequatur nobis exercitationem molestias fugiat commodi omnis. Asperiores quia tenetur nemo ipsa.</p>

        <h3>My Dog</h3>
        <img src="" alt="doggy" />
        <p>Lorem, ipsum dolor sit amet consectetur adipisicing elit. Sit libero deleniti rerum quo, incidunt vel consequatur culpa ullam. Magnam facere earum unde harum. Ea culpa veritatis magnam at aliquid. Perferendis totam placeat molestias illo laudantium? Minus id minima doloribus dolorum fugit deserunt qui vero voluptas, ut quia cum amet temporibus veniam ad ea ab perspiciatis, enim accusamus asperiores explicabo provident. Voluptates sint, neque fuga cum illum, tempore autem maxime similique laborum odio, magnam esse. Aperiam?</p>

        <li><i class="fas fa-home"></i><a href="#"> Home</a></li>
        <li><i class="fas fa-user-alt"></i><a href="#"> About</a></li>
        <li><i class="fas fa-envelope"></i><a href="#"> Contact</a></li>
    <script src="script.js"></script>

After pasting the HTML code, Now have to create a second CSS file with the named style.css. Paste the below code on it and save it. Again remember to give .css extension to CSS file.

@import url('');

* {
  box-sizing: border-box;

body {
  font-family: 'Lato', sans-serif;
  background-color: #333;
  color: #222;
  overflow-x: hidden;
  margin: 0;

.container {
  background-color: #fafafa;
  transform-origin: top left;
  transition: transform 0.5s linear;
  width: 100vw;
  min-height: 100vh;
  padding: 50px;
} {
  transform: rotate(-20deg);

.circle-container {
  position: fixed;
  top: -100px;
  left: -100px;

.circle {
  background-color: #ff7979;
  height: 200px;
  width: 200px;
  border-radius: 50%;
  position: relative;
  transition: transform 0.5s linear;
} .circle {
  transform: rotate(-70deg);

.circle button {
  cursor: pointer;
  position: absolute;
  top: 50%;
  left: 50%;
  height: 100px;
  background: transparent;
  border: 0;
  font-size: 26px;
  color: #fff;

.circle button:focus {
  outline: none;

.circle button#open {
  left: 60%;

.circle button#close {
  top: 60%;
  transform: rotate(90deg);
  transform-origin: top left;
} + nav li {
  transform: translateX(0);
  transition-delay: 0.3s;

nav {
  position: fixed;
  bottom: 40px;
  left: 0;
  z-index: 100;

nav ul {
  list-style-type: none;
  padding-left: 30px;

nav ul li {
  text-transform: uppercase;
  color: #fff;
  margin: 40px 0;
  transform: translateX(-100%);
  transition: transform 0.4s ease-in;

nav ul li i {
  font-size: 20px;
  margin-right: 10px;

nav ul li + li {
  margin-left: 15px;
  transform: translateX(-150%);

nav ul li + li + li {
  margin-left: 30px;
  transform: translateX(-200%);

nav a{
  color: #fafafa;
  text-decoration: none;
  transition: all 0.5s;

nav a:hover {
  color: #FF7979;
  font-weight: bold;

.content img {
  max-width: 100%;

.content {
  max-width: 1000px;
  margin: 50px auto;

.content h1 {
  margin: 0;

.content small {
  color: #555;
  font-style: italic;

.content p {
  color: #333;
  line-height: 1.5;

At last, you have to create a Javascript file with the named script.js and paste the Js code on it and save it again don’t forget to give the .js extension to the Javascript file.

const open = document.getElementById('open')
const close = document.getElementById('close')
const container = document.querySelector('.container')

open.addEventListener('click', () => container.classList.add('show-nav'))

close.addEventListener('click', () => container.classList.remove('show-nav'))

That’s all after pasting the code now your code will be successfully run. If you get any kind of error/problem in the code just comment down or contact me

2 thoughts on “Rotating Navigation using HTML, CSS, and JS”

Leave a Comment