How to set horizontal aligned accordion in Bootstrap 4 ? Last Updated : 08 Feb, 2022 Comments Improve Suggest changes Like Article Like Report Accordion vertical is quite popular in web development, but horizontal accordion is required in few cases to that in this article we will use pointer-events. We will take the writing mode to change the accordion title view. And use the transform to rotate the whole accordion. Below program illustrates the above approach: Program: HTML <!DOCTYPE html> <html> <head> <title>Horizontal Accordion</title> <link href= "https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" /> <link href= "https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css" rel="stylesheet" /> <script src= "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"> </script> <script src= "https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.0/umd/popper.min.js"> </script> <script src= "https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js"> </script> <style> .accordion { text-align: center; } .accordion.width { display: flex; width: 200px; } .accordion.width .card { flex-direction: row; min-width: min-content; } .accordion.width .card .card-header { cursor: pointer; transform: rotate(180deg); writing-mode: vertical-rl; background-color: #0F9D58; border: 2px solid black; } .card-body { width: 200px; background-color: ; } .collapsing.width { transition: width 0.5s ease; height: auto; width: 10px; } h1 { color: green; } </style> </head> <body> <center> <!-- Header and tags --> <h1>GeeksforGeeks</h1> <b>A Computer Science Portal for Geeks</b> <p>A Horizontal Accordion</p> <div class="accordion width" id="accordionHorizontalExample"> <!-- Accordion group creating--> <div class="card"> <div class="card-header" data-toggle="collapse" data-target="#collapseOne"> Accordion Slide 1 </div> <div id="collapseOne" class="collapse show width" data-parent="#accordionHorizontalExample"> <div class="card-body"> If you like GeeksforGeeks and would like to contribute you can also write an article using write.geeksforgeeks.org </div> </div> </div> <div class="card"> <div class="card-header" data-toggle="collapse" data-target="#collapseTwo"> Accordion Slide 2 </div> <div id="collapseTwo" class="collapse width" data-parent="#accordionHorizontalExample"> <div class="card-body"> If you like GeeksforGeeks and would like to contribute you can also write an article using write.geeksforgeeks.org </div> </div> <div class="card"> <div class="card-header" data-toggle="collapse" data-target="#collapseThree"> Accordion Slide 3 </div> <div id="collapseThree" class="collapse width" data-parent="#accordionHorizontalExample"> <div class="card-body"> If you like GeeksforGeeks and would like to contribute you can also write an article using write.geeksforgeeks.org </div> </div> </div> <script> var horizontalAccordions = $(".accordion.width"); horizontalAccordions.each(function() { var accordion = $(this); var collapse = accordion.find(".collapse"); var bodies = collapse.find("> *"); accordion.height(accordion.height()); bodies.width(bodies.eq(0).width()); collapse.not(".show").each(function() { $(this).parent().find("[data-toggle='collapse']") .addClass("collapsed"); }); }); </script> </div> </div> </center> </body> </html> Output: Before Clicking Accordion:After Clicking Accordion: Comment More infoAdvertise with us Next Article How to col align right in Bootstrap 5 ? S skyridetim Follow Improve Article Tags : Web Technologies Bootstrap Bootstrap-Misc Similar Reads How to Align Text in Bootstrap Column ? In Bootstrap Framework, we can align the text within the columns using various utility classes. To align text within a Bootstrap column, use the built-in utility classes such as text-start, text-center, and text-end for the left, center, and right alignment, respectively. Simply apply the desired cl 3 min read How to col align right in Bootstrap 5 ? Bootstrap 5 provides a series of classes that can be used to apply various styling to the tables such as changing the heading appearance, making the rows striped, adding or removing borders, making rows hoverable, etc. In this article, we will learn how we can right align the content in Col. We will 3 min read How to Change Bootstrap Accordion Background Color ? To change the Bootstrap Accordion background color, target the .accordion-body class and apply a background-color property via custom CSS. Alternatively, use Bootstrap utility classes like .bg-primary, .bg-secondary, etc., for predefined background colors. Syntax: <div class="accordion" id="myAcc 4 min read How to set the button alignment in Bootstrap ? Bootstrap buttons are no different from any other DOM elements of an HTML document. Aligning them is more likely the same as aligning paragraphs, divs and sections. Here are some of the scenarios that one can encounter.Here we are using some common methods:Table of ContentButtons in container classB 4 min read How to make horizontal scrollable in a bootstrap row? Here is the task to make horizontally scrollable in a bootstrap row. It can be done by the following approach: Approach: Making all the div element in inline using display: inline-block; propertyAdding the scroll bar to all the div element using overflow-x: auto; property.white-space: nowrap; proper 1 min read How to change (-, +) symbol with a button in Bootstrap Accordion ? In Bootstrap 4, there is no default option for changing (-, +) symbol with a button accordion. Hence it can be done by using jQuery. The Following Approach will explain clearly.Approach:Â Â Font awesome or any icon utilities to display (-, +) symbol:Â Â <link rel="stylesheet" href="https://use.font 4 min read Like