Bhupinder Kumar Bhupinder Kumar - 24 days ago 14
CSS Question

css transition from right to left on click with css

I am trying to make the css for right to left div when it will open but i dont want use any java script and jquery only need pure css.

enter image description here

Answer

You can make in center and do like this with css

 section { 
      position: relative;
      width:800px;
      margin:50px auto

    }

    div { 
      position: absolute;
      width: 100%;
      display: flex;
      justify-content: center;
      align-items: center;  
      background: #6698F5;
      clip: rect(0, 100vw, auto, 100vw);
      animation: slide 1.5s linear 1s forwards; 
    }

    @keyframes slide {
      100% { clip: rect(0, 100vw, auto, 0); }
    }