Bootstrap snippet. How to create an accordion from scratch

This Bootstrap snippet. How to create an accordion from scratch, was created to help web designers,
front-end developers and back-end developer save time. Use it in your project and build your app faster,
You can also download the HTML, CSS, and JS code.
tags: accordion,javascript,css,animated accordion,simple accordion,bootstrap accordion,bs4,bs4 accordion

HTML code

This is the html code used to create this bootstrap snippet, You can copy, paste, change, customize and run the following HTML code to get a result like the one shown in the preview selection

<div class="row">
    <div class="col-sm-12">
        <h4>How to create an accordion from scratch</h4>
    </div>
</div>

<div class="row">
    <div class="col-sm-6">
        <h6>Simple Accordion</h6>
        <button class="accordion"> Section 1</button>
        <div class="panel">
            Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
            Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
        </div>
        
         <button class="accordion"> Section 1</button>
        <div class="panel">
            Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
            Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
        </div>
        
         <button class="accordion"> Section 1</button>
        <div class="panel">
            Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
            Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
        </div>
    </div>
    
     <div class="col-sm-6">
        <h6>Animated Accordion (slide Down)</h6>
    </div>
</div>

CSS code

This is the css code used to create this bootstrap snippet, You can copy, paste, change, customize and run the following CSS code to get a result Like the one shown in the preview selection

body{margin-top:20px; background: #e6e6ff}

h4, h6{
    padding: 10px;    
}

/* Simple Accordion Block */
.accordion{
    margin: 10px;
    background: #3399ff;
    border: none;
    outline: none;
    width: 100%;
    transition: 0.4s;
    cursor: pointer;
    text-align: left;
}

.active, .accrodion:hover{
    color: #fff;
    background: #0066cc;
}

.panel{
    padding: 0px 10px;
}
/* Animated Accordion Block */
                                    

Similar snippets

Bootstrap snippet bs4 Task Board page

bs4 Task Board page

View

Bootstrap snippet bs4 past orders profile

bs4 past orders profile

View

Bootstrap snippet bs4 projects

bs4 projects

View

Bootstrap snippet bs4 File Manager

bs4 File Manager

View

Bootstrap snippets. How to create an accordion from scratch

About this bootstrap snippet

This bootstrap snippet, How to create an accordion from scratch, was published on Jan 6th 2018, 15:10 by Bettaibi Nidhal and it is free.

We hope you will enjoy this awesome snippet and stay tuned for the latest updates, bootdey snippets are already used in thousands of blogs, websites and projects. We believe it will save your precious time and gives trendy look to your next web project.

We always try to offer the best beautiful and responsive source of Bootstrap code examples and components.

This snippet currectly have 189 views, Using this bootstrap snippet you have the following benefits:

Bootstrap 4.0.0-beta

This snippet is based on bootstrap 4.0.0-beta and the grid system of this framework

Responsive

Based on bootstrap framework makes all the layouts perfectly responsive for all devices

Crossbrowser compatibility

Tested on all major browsers, it works smoothly on all of them

Jquery plugins

Great built-in plugins with jquery framework, you can easy to change all declarations

semantic html 5

Built on html / css3 the code quality is really amazing

Simple Integration

This snippet can be simply integrated on existing sites and new ones too, all you need to do is copy the code and start working