{"id":16058,"date":"2017-02-13T16:15:52","date_gmt":"2017-02-13T14:15:52","guid":{"rendered":"http:\/\/www.webcodegeeks.com\/?p=16058"},"modified":"2018-01-08T13:16:04","modified_gmt":"2018-01-08T11:16:04","slug":"bootstrap-accordion-example","status":"publish","type":"post","link":"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-accordion-example\/","title":{"rendered":"Bootstrap Accordion Example"},"content":{"rendered":"<p>In this tutorial, we will show you how to create an accordion widget with Bootstrap. The accordion is a feature which allows you to show and hide components with a nice transition. To follow, all you need is a text editor. I will be using Notepad++; you are free of course to use one of your choice.<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n[ulp id=&#8217;57DHuNTHJ2qczaGz&#8217;]<\/p>\n<h2>1. Project setup<\/h2>\n<p>Let&#8217;s start by creating a sample Bootstrap project in a file called Bootstrap accordion.html. You will need to include the Bootstrap CSS and JavaScript libraries, as well as jQuery. I have chosen to use Bootstrap 3.3.7 and jQuery 3.1.1.<\/p>\n<p><span style=\"text-decoration: underline;\"><em>Bootstrap accordion.html<\/em><\/span><\/p>\n<pre class=\"brush:xml\">&lt;!DOCTYPE html&gt;\r\n&lt;html&gt;\r\n&lt;head&gt;\r\n    &lt;link rel=\"stylesheet\" href=\"https:\/\/maxcdn.bootstrapcdn.com\/bootstrap\/3.3.7\/css\/bootstrap.min.css\"&gt;&lt;\/link&gt; \r\n    &lt;script src=\"http:\/\/code.jquery.com\/jquery-3.1.1.min.js\"&gt;&lt;\/script&gt;\r\n    &lt;script src=\"https:\/\/maxcdn.bootstrapcdn.com\/bootstrap\/3.3.7\/js\/bootstrap.min.js\"&gt;&lt;\/script&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n<p>Now, let&#8217;s add a group of panels and a button to our page.<\/p>\n<p><span style=\"text-decoration: underline;\"><em>Bootstrap accordion.html<\/em><\/span><\/p>\n<pre class=\"brush:xml\">&lt;!DOCTYPE html&gt;\r\n&lt;html&gt;\r\n&lt;head&gt;\r\n    &lt;link rel=\"stylesheet\" href=\"https:\/\/maxcdn.bootstrapcdn.com\/bootstrap\/3.3.7\/css\/bootstrap.min.css\"&gt;&lt;\/link&gt; \r\n    &lt;script src=\"http:\/\/code.jquery.com\/jquery-3.1.1.min.js\"&gt;&lt;\/script&gt;\r\n    &lt;script src=\"https:\/\/maxcdn.bootstrapcdn.com\/bootstrap\/3.3.7\/js\/bootstrap.min.js\"&gt;&lt;\/script&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n    &lt;div class=\"panel-group\"&gt;\r\n        &lt;div class=\"panel panel-default\"&gt;\r\n            &lt;div class=\"panel-heading\"&gt;\r\n                &lt;div class=\"panel-title\"&gt;\r\n                    Panel 1 header\r\n                &lt;\/div&gt;\r\n            &lt;\/div&gt;\r\n            &lt;div&gt;\r\n                &lt;div class=\"panel-body\"&gt;\r\n                    Panel 1 content\r\n                &lt;\/div&gt;\r\n            &lt;\/div&gt;\r\n        &lt;\/div&gt;\r\n        &lt;div class=\"panel panel-default\"&gt;\r\n            &lt;div class=\"panel-heading\"&gt;\r\n                &lt;div class=\"panel-title\"&gt;\r\n                    Panel 2 header\r\n                &lt;\/div&gt;\r\n            &lt;\/div&gt;\r\n            &lt;div&gt;\r\n                &lt;div class=\"panel-body\"&gt;\r\n                    Panel 2 content\r\n                &lt;\/div&gt;\r\n            &lt;\/div&gt;\r\n        &lt;\/div&gt;\r\n    &lt;\/div&gt;\r\n    \r\n    &lt;button type=\"button\" class=\"btn\"&gt;My button&lt;\/button&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;<\/pre>\n<p><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/02\/setup.png\"><img decoding=\"async\" class=\"wp-image-16102 size-full aligncenter\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/02\/setup.png\" width=\"860\" height=\"409\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/02\/setup.png 860w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/02\/setup-300x143.png 300w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/02\/setup-768x365.png 768w\" sizes=\"(max-width: 860px) 100vw, 860px\" \/><\/a><\/p>\n<p style=\"text-align: center;\"><em>Fig. 1: Setup<\/em><\/p>\n<h2>2. Adding the accordion<\/h2>\n<h3>2.1 Panel group<\/h3>\n<p>To add the accordion to the panel group, we&#8217;ll follow these steps:<\/p>\n<ul>\n<li>Add an ID to the group of panels.<\/li>\n<li>Configure each panel body to be collapsed.<\/li>\n<li>Configure the title of each panel to collapse the panel body when pressed.<\/li>\n<\/ul>\n<p>First off, we&#8217;ll give our group of panels a clear ID we can easily associate with it.<\/p>\n<pre class=\"brush:xml\">&lt;div id=\"parentPanelGroup\" class=\"panel-group\"&gt;<\/pre>\n<p>Now, let&#8217;s configure our first panel&#8217;s body for collapsing by giving it an ID and assigning it to a class called <em>collapse<\/em>.<\/p>\n<pre class=\"brush:xml\">&lt;div id=\"panel1BodyWrapper\" class=\"collapse\"&gt;\r\n\r\n&lt;div class=\"panel-body\"&gt;\r\n    Panel 1 content\r\n&lt;\/div&gt;\r\n\r\n&lt;\/div&gt;<\/pre>\n<p>And to wrap it up, let&#8217;s add a paragraph tag in our first panel&#8217;s title. We will give this paragraph the following attributes:<\/p>\n<ul>\n<li><em>data-parent=&#8221;#parentPanelGroup&#8221;<\/em>: The parent attribute is used to identify all the elements which belong to the same collapsible group. When an element inside a collapsible group is shown, all the other collapsible elements are hidden. In our case, the parent is the panel group.<\/li>\n<li><em>data-target=&#8221;#panel1BodyWrapper&#8221;<\/em>: The target attribute refers to the element to be collapsed (in our case, the panel body).<\/li>\n<li><em>data-toggle=&#8221;collapse&#8221;<\/em>: This tells Bootstrap to toggle the element referred to in the <em>data-target<\/em>, and hide all other elements inside the <em>data-parent<\/em>.<\/li>\n<\/ul>\n<p>Repeat those three steps for the second panel. Our group of panels is now fully collapsible. The final code is as follows.<\/p>\n<p><span style=\"text-decoration: underline;\"><em>Bootstrap accordion.html<\/em><\/span><\/p>\n<pre class=\"brush:xml\">&lt;!DOCTYPE html&gt;\r\n&lt;html&gt;\r\n&lt;head&gt;\r\n    &lt;link rel=\"stylesheet\" href=\"https:\/\/maxcdn.bootstrapcdn.com\/bootstrap\/3.3.7\/css\/bootstrap.min.css\"&gt;&lt;\/link&gt; \r\n    &lt;script src=\"http:\/\/code.jquery.com\/jquery-3.1.1.min.js\"&gt;&lt;\/script&gt;\r\n    &lt;script src=\"https:\/\/maxcdn.bootstrapcdn.com\/bootstrap\/3.3.7\/js\/bootstrap.min.js\"&gt;&lt;\/script&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n    &lt;div id=\"parentPanelGroup\" class=\"panel-group\"&gt;\r\n        &lt;div class=\"panel panel-default\"&gt;\r\n            &lt;div class=\"panel-heading\"&gt;\r\n                &lt;div class=\"panel-title\"&gt;\r\n                    Panel 1 header                    \r\n                &lt;\/div&gt;\r\n            &lt;\/div&gt;\r\n            &lt;div id=\"panel1BodyWrapper\" class=\"panel-collapse collapse\"&gt;\r\n                &lt;div class=\"panel-body\"&gt;\r\n                    Panel 1 content\r\n                &lt;\/div&gt;\r\n            &lt;\/div&gt;\r\n        &lt;\/div&gt;\r\n        &lt;div class=\"panel panel-default\"&gt;\r\n            &lt;div class=\"panel-heading\"&gt;\r\n                &lt;div class=\"panel-title\"&gt;\r\n                        Panel 2 header\r\n                &lt;\/div&gt;\r\n            &lt;\/div&gt;\r\n            &lt;div id=\"panel2-body-wrapper\" class=\"panel-collapse collapse\"&gt;\r\n                &lt;div class=\"panel-body\"&gt;\r\n                    Panel 2 content\r\n                &lt;\/div&gt;\r\n            &lt;\/div&gt;\r\n        &lt;\/div&gt;\r\n    &lt;\/div&gt;\r\n    \r\n    &lt;button type=\"button\" class=\"btn\"&gt;My button&lt;\/button&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;<\/pre>\n<h3>2.2 Button<\/h3>\n<p>Let&#8217;s now try to hide or show some text every time we click the button.<\/p>\n<p>We&#8217;ll be following these steps to do so:<\/p>\n<ul>\n<li>Add a div under the button containing some text, and configure it for collapsing<\/li>\n<li>Configure the button to collapse the div every time it&#8217;s pressed.<\/li>\n<\/ul>\n<p>We will configure the div for collapsing the same way we configure the panel bodies:<\/p>\n<ul>\n<li>Give the div an ID<\/li>\n<li>Give it an attribute called <em>class<\/em> with value=<em>&#8220;collapse&#8221;.<\/em><\/li>\n<\/ul>\n<p>This is the code for the div:<\/p>\n<pre class=\"brush:xml\">&lt;div id=\"textDiv\" class=\"collapse\"&gt;\r\nSome Lorem Ipsum, or other deep text.\r\n&lt;\/div&gt;<\/pre>\n<p>Finally, let&#8217;s configure the button to collapse the div. Notice that we omit the <em>data-parent<\/em> attribute, because it is not needed; we will however add the <em>data-toggle<\/em> and <em>data-target<\/em> attributes.<\/p>\n<pre class=\"brush:xml\">&lt;button type=\"button\" class=\"btn collapsed\" data-toggle=\"collapse\" data-target=\"#textDiv\"&gt;My button&lt;\/button&gt;<\/pre>\n<p>When the button is pressed, it will now alternatively show and hide the text div.<\/p>\n<p><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/02\/final.png\"><img decoding=\"async\" class=\"aligncenter wp-image-16103 size-full\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/02\/final.png\" width=\"860\" height=\"409\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/02\/final.png 860w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/02\/final-300x143.png 300w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/02\/final-768x365.png 768w\" sizes=\"(max-width: 860px) 100vw, 860px\" \/><\/a><\/p>\n<p style=\"text-align: center;\"><em>Fig. 2: Our final page<\/em><\/p>\n<h2>3. Options<\/h2>\n<p>Here are a few options you can make use of.<\/p>\n<ul>\n<li>collapse in: If you want your collapsible element to be shown by default, set its class to &#8220;collapse in&#8221; instead of just &#8220;collapse&#8221;.<\/li>\n<li>collapsing: An element which is in the process of being shown or hidden has a class called &#8220;collapsing&#8221;. You can use this to tweak the animation. See below.<\/li>\n<\/ul>\n<p><span style=\"text-decoration: underline;\"><em>Bootstrap accordion.html<\/em><\/span><\/p>\n<pre class=\"brush:xml\">&lt;!DOCTYPE html&gt;\r\n&lt;html&gt;\r\n&lt;head&gt;\r\n    &lt;link rel=\"stylesheet\" href=\"https:\/\/maxcdn.bootstrapcdn.com\/bootstrap\/3.3.7\/css\/bootstrap.min.css\"&gt;&lt;\/link&gt; \r\n    &lt;script src=\"http:\/\/code.jquery.com\/jquery-3.1.1.min.js\"&gt;&lt;\/script&gt;\r\n    &lt;script src=\"https:\/\/maxcdn.bootstrapcdn.com\/bootstrap\/3.3.7\/js\/bootstrap.min.js\"&gt;&lt;\/script&gt;\r\n\r\n    &lt;style&gt;\r\n\t.collapsing {\r\n\t    opacity: 0.5\r\n\t}\r\n    &lt;\/style&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n    &lt;button type=\"button\" class=\"btn collapsed\" data-toggle=\"collapse\" data-target=\"#textDiv\"&gt;My button&lt;\/button&gt;\r\n\r\n    &lt;div id=\"textDiv\" class=\"collapse\"&gt;\r\n        Some Lorem Ipsum, or other deep text.\r\n    &lt;\/div&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;<\/pre>\n<p style=\"text-align: center;\"><em>Set opacity to 0.5 when an element is showing\/hiding.<\/em><\/p>\n<ul>\n<li>Collapse methods: you can use JavaScript to collapse a collapsible element.<\/li>\n<\/ul>\n<p><span style=\"text-decoration: underline;\"><em>Bootstrap accordion with JavaScript.html<\/em><\/span><\/p>\n<pre class=\"brush:xml\">&lt;!DOCTYPE html&gt;\r\n&lt;html&gt;\r\n&lt;head&gt;\r\n    &lt;link rel=\"stylesheet\" href=\"https:\/\/maxcdn.bootstrapcdn.com\/bootstrap\/3.3.7\/css\/bootstrap.min.css\"&gt;&lt;\/link&gt; \r\n    &lt;script src=\"http:\/\/code.jquery.com\/jquery-3.1.1.min.js\"&gt;&lt;\/script&gt;\r\n    &lt;script src=\"https:\/\/maxcdn.bootstrapcdn.com\/bootstrap\/3.3.7\/js\/bootstrap.min.js\"&gt;&lt;\/script&gt;\r\n\r\n    &lt;script&gt;\r\n\tfunction doToggle() {\r\n\t\t$(\".collapse\").collapse(\"toggle\");\r\n\t}\r\n \r\n\tfunction doShow() {\r\n\t\t$(\".collapse\").collapse(\"show\");\r\n\t}\r\n \r\n\tfunction doHide() {\r\n\t\t$(\".collapse\").collapse(\"hide\");\r\n\t}\r\n    &lt;\/script&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n    &lt;button onclick=\"doToggle()\" &gt;Toggle&lt;\/button&gt;\r\n    &lt;button onclick=\"doShow()\"&gt;Show&lt;\/button&gt;\r\n    &lt;button onclick=\"doHide()\"&gt;Hide&lt;\/button&gt;\r\n    \r\n&lt;div id=\"textDiv\" class=\"collapse\"&gt;\r\n        Some Lorem Ipsum, or other deep text.\r\n    &lt;\/div&gt;\r\n\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;<\/pre>\n<h2>3. Summary<\/h2>\n<p>That covers our quickstart guide to the Bootstrap accordion. We have learnt the fundamentals of the accordion functionality in Bootstrap and know how to add it to different HTML elements. We have also seen how we can use JavaScript to interact with the accordion.<\/p>\n<h2>4. Download the source code<\/h2>\n<div class=\"download\"><strong>Download<\/strong><br \/>\nYou can download the full code here: <strong><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/02\/WCG.zip\">Bootstrap accordion<\/a><\/strong><\/div>\n","protected":false},"excerpt":{"rendered":"<p>In this tutorial, we will show you how to create an accordion widget with Bootstrap. The accordion is a feature which allows you to show and hide components with a nice transition. To follow, all you need is a text editor. I will be using Notepad++; you are free of course to use one of &hellip;<\/p>\n","protected":false},"author":216,"featured_media":8515,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[284],"tags":[],"class_list":["post-16058","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-bootstrap"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Bootstrap Accordion Example - Web Code Geeks - 2026<\/title>\n<meta name=\"description\" content=\"In this tutorial, we will show you how to create an accordion widget with Bootstrap. The accordion is a feature which allows you to show and hide\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-accordion-example\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Bootstrap Accordion Example - Web Code Geeks - 2026\" \/>\n<meta property=\"og:description\" content=\"In this tutorial, we will show you how to create an accordion widget with Bootstrap. The accordion is a feature which allows you to show and hide\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-accordion-example\/\" \/>\n<meta property=\"og:site_name\" content=\"Web Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webcodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2017-02-13T14:15:52+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2018-01-08T11:16:04+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/11\/bootstrap-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Christopher Leneve\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@webcodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@webcodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Christopher Leneve\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-accordion-example\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-accordion-example\/\"},\"author\":{\"name\":\"Christopher Leneve\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/a2bd8cabd55ea6b147dc8fb2e5e606f7\"},\"headline\":\"Bootstrap Accordion Example\",\"datePublished\":\"2017-02-13T14:15:52+00:00\",\"dateModified\":\"2018-01-08T11:16:04+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-accordion-example\/\"},\"wordCount\":645,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-accordion-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/11\/bootstrap-logo.jpg\",\"articleSection\":[\"Bootstrap\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-accordion-example\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-accordion-example\/\",\"url\":\"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-accordion-example\/\",\"name\":\"Bootstrap Accordion Example - Web Code Geeks - 2026\",\"isPartOf\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-accordion-example\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-accordion-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/11\/bootstrap-logo.jpg\",\"datePublished\":\"2017-02-13T14:15:52+00:00\",\"dateModified\":\"2018-01-08T11:16:04+00:00\",\"description\":\"In this tutorial, we will show you how to create an accordion widget with Bootstrap. The accordion is a feature which allows you to show and hide\",\"breadcrumb\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-accordion-example\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-accordion-example\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-accordion-example\/#primaryimage\",\"url\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/11\/bootstrap-logo.jpg\",\"contentUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/11\/bootstrap-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-accordion-example\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.webcodegeeks.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"CSS\",\"item\":\"https:\/\/www.webcodegeeks.com\/category\/css\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Bootstrap\",\"item\":\"https:\/\/www.webcodegeeks.com\/category\/css\/bootstrap\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Bootstrap Accordion Example\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#website\",\"url\":\"https:\/\/www.webcodegeeks.com\/\",\"name\":\"Web Code Geeks\",\"description\":\"Web Developers Resource Center\",\"publisher\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.webcodegeeks.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\/\/www.webcodegeeks.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"contentUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webcodegeeks\",\"https:\/\/x.com\/webcodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/a2bd8cabd55ea6b147dc8fb2e5e606f7\",\"name\":\"Christopher Leneve\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/48dcf3df34e69343d3e26d69aef515cedc3b750abba2e0f1d7f755df14030431?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/48dcf3df34e69343d3e26d69aef515cedc3b750abba2e0f1d7f755df14030431?s=96&d=mm&r=g\",\"caption\":\"Christopher Leneve\"},\"description\":\"Chris is a developer with over four years of experience. He has come to specialize in web development over the years. Chris is very interested in IT in general, as well as robotics.\",\"sameAs\":[\"https:\/\/www.webcodegeeks.com\"],\"url\":\"https:\/\/www.webcodegeeks.com\/author\/christopher-leneve\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Bootstrap Accordion Example - Web Code Geeks - 2026","description":"In this tutorial, we will show you how to create an accordion widget with Bootstrap. The accordion is a feature which allows you to show and hide","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-accordion-example\/","og_locale":"en_US","og_type":"article","og_title":"Bootstrap Accordion Example - Web Code Geeks - 2026","og_description":"In this tutorial, we will show you how to create an accordion widget with Bootstrap. The accordion is a feature which allows you to show and hide","og_url":"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-accordion-example\/","og_site_name":"Web Code Geeks","article_publisher":"https:\/\/www.facebook.com\/webcodegeeks","article_published_time":"2017-02-13T14:15:52+00:00","article_modified_time":"2018-01-08T11:16:04+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/11\/bootstrap-logo.jpg","type":"image\/jpeg"}],"author":"Christopher Leneve","twitter_card":"summary_large_image","twitter_creator":"@webcodegeeks","twitter_site":"@webcodegeeks","twitter_misc":{"Written by":"Christopher Leneve","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-accordion-example\/#article","isPartOf":{"@id":"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-accordion-example\/"},"author":{"name":"Christopher Leneve","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/a2bd8cabd55ea6b147dc8fb2e5e606f7"},"headline":"Bootstrap Accordion Example","datePublished":"2017-02-13T14:15:52+00:00","dateModified":"2018-01-08T11:16:04+00:00","mainEntityOfPage":{"@id":"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-accordion-example\/"},"wordCount":645,"commentCount":0,"publisher":{"@id":"https:\/\/www.webcodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-accordion-example\/#primaryimage"},"thumbnailUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/11\/bootstrap-logo.jpg","articleSection":["Bootstrap"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-accordion-example\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-accordion-example\/","url":"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-accordion-example\/","name":"Bootstrap Accordion Example - Web Code Geeks - 2026","isPartOf":{"@id":"https:\/\/www.webcodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-accordion-example\/#primaryimage"},"image":{"@id":"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-accordion-example\/#primaryimage"},"thumbnailUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/11\/bootstrap-logo.jpg","datePublished":"2017-02-13T14:15:52+00:00","dateModified":"2018-01-08T11:16:04+00:00","description":"In this tutorial, we will show you how to create an accordion widget with Bootstrap. The accordion is a feature which allows you to show and hide","breadcrumb":{"@id":"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-accordion-example\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-accordion-example\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-accordion-example\/#primaryimage","url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/11\/bootstrap-logo.jpg","contentUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/11\/bootstrap-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-accordion-example\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.webcodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"CSS","item":"https:\/\/www.webcodegeeks.com\/category\/css\/"},{"@type":"ListItem","position":3,"name":"Bootstrap","item":"https:\/\/www.webcodegeeks.com\/category\/css\/bootstrap\/"},{"@type":"ListItem","position":4,"name":"Bootstrap Accordion Example"}]},{"@type":"WebSite","@id":"https:\/\/www.webcodegeeks.com\/#website","url":"https:\/\/www.webcodegeeks.com\/","name":"Web Code Geeks","description":"Web Developers Resource Center","publisher":{"@id":"https:\/\/www.webcodegeeks.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.webcodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.webcodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.webcodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webcodegeeks","https:\/\/x.com\/webcodegeeks"]},{"@type":"Person","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/a2bd8cabd55ea6b147dc8fb2e5e606f7","name":"Christopher Leneve","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/48dcf3df34e69343d3e26d69aef515cedc3b750abba2e0f1d7f755df14030431?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/48dcf3df34e69343d3e26d69aef515cedc3b750abba2e0f1d7f755df14030431?s=96&d=mm&r=g","caption":"Christopher Leneve"},"description":"Chris is a developer with over four years of experience. He has come to specialize in web development over the years. Chris is very interested in IT in general, as well as robotics.","sameAs":["https:\/\/www.webcodegeeks.com"],"url":"https:\/\/www.webcodegeeks.com\/author\/christopher-leneve\/"}]}},"_links":{"self":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts\/16058","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/users\/216"}],"replies":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/comments?post=16058"}],"version-history":[{"count":0,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts\/16058\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/media\/8515"}],"wp:attachment":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/media?parent=16058"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/categories?post=16058"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/tags?post=16058"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}