TabsTutorials

Animated Tab Bar

Animated Tab Bar

Animated Tab Bar

Before We Start to Animated Tab Bar

Animated Tab Bar can be used to animate a Navigation bar, Menu, etc. and create user attractive UI components.

So if you are a person who wishes to develop a website, you have to know how to create animations properly. Check out our tutorial and you can learn this techniques and use it on your web development. Below sections shows how to develop this animations.

How to create? We are here to solve your problem. In this article we discuss how to create a hover effect animations. Before we start please read the below articles which easier you to understand the process, if you are new to development.

Step 1 – Add HTML

It’s too easy and simple. Just copy and paste below code in your HTML editor between <body> </body> tag as below.

<body>
 <div class="worko-tabs">

        <input class="state" type="radio" title="tab-one" name="tabs-state" id="tab-one" checked />
        <input class="state" type="radio" title="tab-two" name="tabs-state" id="tab-two" />
        <input class="state" type="radio" title="tab-three" name="tabs-state" id="tab-three" />
        <input class="state" type="radio" title="tab-four" name="tabs-state" id="tab-four" />

        <div class="tabs flex-tabs">
            <label for="tab-one" id="tab-one-label" class="tab">Tab 1</label>
            <label for="tab-two" id="tab-two-label" class="tab">Tab 2</label>
            <label for="tab-three" id="tab-three-label" class="tab">Tab 3</label>
            <label for="tab-four" id="tab-four-label" class="tab">Tab 4</label>

            <div id="tab-one-panel" class="panel active">
                <h3>Title 1</h3>
                <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
            </div>
            <div id="tab-two-panel" class="panel">
                <h3>Title 2</h3>
                <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
            </div>
            <div id="tab-three-panel" class="panel">
                <h3>Title 3</h3>
                <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
            </div>
            <div id="tab-four-panel" class="panel">
                <h3>Title 4</h3>
                <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
            </div>
        </div>

    </div>
</body>

Step 2 – Add CSS

Copy and paste below code in your HTML editor between <style></style> tag as below.

<style>
        @-webkit-keyframes fake {
            from {
                opacity: 1;
            }

            to {
                opacity: 1;
            }
        }

        @keyframes fake {
            from {
                opacity: 1;
            }

            to {
                opacity: 1;
            }
        }

        body {
            -webkit-animation: fake 1s infinite;
            animation: fake 1s infinite;
        }

        .worko-tabs {
            margin: 20px;
            width: 80%;
        }

        .worko-tabs .state {
            position: absolute;
            left: -10000px;
        }

        .worko-tabs .flex-tabs {
            display: flex;
            justify-content: space-between;
            flex-wrap: wrap;
        }

        .worko-tabs .flex-tabs .tab {
            flex-grow: 1;
            max-height: 40px;
        }

        .worko-tabs .flex-tabs .panel {
            background-color: #fff;
            padding: 20px;
            min-height: 300px;
            display: none;
            width: 100%;
            flex-basis: auto;
        }

        .worko-tabs .tab {
            display: inline-block;
            padding: 10px;
            vertical-align: top;
            background-color: #f7f7f7;
            cursor: hand;
            cursor: pointer;
            border-left: 10px solid #ccc;
        }

        .worko-tabs .tab:hover {
            background-color: #fff;
        }

        #tab-one:checked~.tabs #tab-one-label,
        #tab-two:checked~.tabs #tab-two-label,
        #tab-three:checked~.tabs #tab-three-label,
        #tab-four:checked~.tabs #tab-four-label {
            background-color: #ddd7eb;
            cursor: default;
            border-left-color: #6c3195;
        }

        #tab-one:checked~.tabs #tab-one-panel,
        #tab-two:checked~.tabs #tab-two-panel,
        #tab-three:checked~.tabs #tab-three-panel,
        #tab-four:checked~.tabs #tab-four-panel {
            display: block;
        }

        @media (max-width: 600px) {
            .flex-tabs {
                flex-direction: column;
            }

            .flex-tabs .tab {
                background: #ddd7eb;
                border-bottom: 1px solid #ccc;
            }

            .flex-tabs .tab:last-of-type {
                border-bottom: none;
            }

            .flex-tabs #tab-one-label {
                order: 1;
            }

            .flex-tabs #tab-two-label {
                order: 3;
            }

            .flex-tabs #tab-three-label {
                order: 5;
            }

            .flex-tabs #tab-four-label {
                order: 7;
            }

            .flex-tabs #tab-one-panel {
                order: 2;
            }

            .flex-tabs #tab-two-panel {
                order: 4;
            }

            .flex-tabs #tab-three-panel {
                order: 6;
            }

            .flex-tabs #tab-four-panel {
                order: 8;
            }

            #tab-one:checked~.tabs #tab-one-label,
            #tab-two:checked~.tabs #tab-two-label,
            #tab-three:checked~.tabs #tab-three-label,
            #tab-four:checked~.tabs #tab-four-label {
                border-bottom: none;
            }

            #tab-one:checked~.tabs #tab-one-panel,
            #tab-two:checked~.tabs #tab-two-panel,
            #tab-three:checked~.tabs #tab-three-panel,
            #tab-four:checked~.tabs #tab-four-panel {
                border-bottom: 1px solid #ccc;
            }
        }
    </style>

At the end we will have something like this. You can change fonts, colors, backgrounds and all things that you want. Enjoy it.

Out Put

Video Tutorial

Please watch this video to better understand this tutorial and don’t forget to subscribe to our channel.


Help others to find out about this article on Social Media sites. If you have any doubt or any problem, don’t hesitate to contact us. Thereafter we will be able to help you and also make sure you bookmark our site on your browser.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button