Simple and Responsive Sidebar designing with background-image animation.

 SIDEBAR DESIGNING WITH ANIMATION ON BACKGROUND IMAGE.






                                       In this program we have designed a sidebar such that as you open or close sidebar then there will be change in position of background image of web page . We have smartly handled MARGIN CSS property. so we hope you will really like this code. 


PROGRAM SOURCE CODE :) 



<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Sidebar Move</title>
    <link rel="stylesheet" type="text/css" 
href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
    <style type="text/css">
        * {
            margin0;
            padding0;
            box-sizingborder-box;
        }
        
        html {
            font-size62.5%;
        }
        
        .a {
            width30rem;
            height100vh;
            background-color#383838;
            padding3rem 0rem;
            transitionall 0.3s ease-in-out;
            positionabsolute;
            left-30rem;
        }
        
        .a h3 {
            font-size4rem;
            text-alignright;
            padding0.7rem 2rem;
            color#f6f6f6;
            font-family: vernda;
        }
        
        .a ul {
            width100%;
        }
        
        .a ul li {
            list-style-typenone;
            margin-top3rem;
            border-bottom.1rem solid #fff;
            text-aligncenter;
            padding2rem 0rem;
        }
        
        .a ul li:hover {
            background-color#7FFF00;
            colorred;
            border-bottom.1rem solid red;
        }
        
        .a ul li:hover a {
            colorred;
        }
        
        .a ul li a {
            text-decorationnone;
            color#fff;
            font-size3rem;
        }
        
        label {
            font-size3rem;
            colorred;
            text-aligncenter;
            cursorpointer;

        }
        
        .fa-bars {
            positionabsolute;
            top3%;
            left1%;
            background-color:black;
            padding0.5rem 1rem;
        }
        
        .fa-times {
            positionabsolute;
            z-index1000;
            top2%;
            transitionall 0.3s ease-in-out;
            transformtranslateX(-100%);
        }
        
        input {
            displaynone;
        }
        
        #i:checked~.a {
            positionabsolute;
            left0;
        }
        
        #i:checked~label .fa-times {
            transformtranslateX(0%);
        }
        
        #i:checked~section {
            margin-left30rem;
        }
        
        section {
            background-imageurl("../Images/Anny1.jpg");
            height100vh;
            background-positioncenter;
            background-repeatno-repeat;
            background-sizecover;
            transitionall 0.3s ease-in-out;
        }
        
        @media(max-width998px) {
            html {
                font-size56%;
            }
        }
        
        @media(max-width600px) {
            html {
                font-size50%;
            }
        }
    </style>
</head>

<body>
    <input type="checkbox" id="i">
    <label for="i"><i class="fa fa-bars" title="open Sidebar"></i></label>
    <label for="i"><i class="fa fa-times" title="close sidebar"></i></label>
    <div class="a">
        <h3>MenuBar</h3>
        <ul>
            <li><a href="#">Home</a></li>
            <li><a href="#">About Us</a></li>
            <li><a href="#">Sevices</a></li>
            <li><a href="#">Our Products</a></li>
            <li><a href="#">Contact Us</a></li>
        </ul>
    </div>
    <section></section>
</body>

</html>






OUTPUT :)






( NOTE : - While executing program you have to replace links of images , audio's  or video's in this program by your links. So take care of it ! )