Posted on

In Bootstrap, there is an enormous number of classes that shape the outcome of the applied webpage. It can be annoying to memorize all the effects, but trying them out before using can be really helpful. Today, I’d like to demonstrate the “show” class in action.

Following is a code snippet of one of the modules in the Bootstrap course I am learning on Coursera.

       <div class="row row-content">
            <div class = "col">
                <h2>Corporate Leadership</h2>
                
                <div id="accordion">
                    <div class="card">
                        <div class="card-header" role="tab" id="peterhead">
                            <h3 class="mb-0">
                                <a data-toggle="collapse" data-target="#peter">
                                    Peter Pan <small>Chief Epicurious Officer</small>
                                </a>
                            </h3>
                        </div>
                        <div role="tabpanel" class="collapse show" id="peter" data-parent="#accordion">
                            <div class="d-none d-sm-block">
                                <p>Our CEO, Peter, credits his hardworking East Asian immigrant parents who undertook the arduous journey to the shores of America with the intention of giving their children the best future. His mother's wizardy in the kitchen whipping up the tastiest dishes with whatever is available inexpensively at the supermarket, was his first inspiration to create the fusion cuisines for which <em>The Frying Pan</em> became well known. He brings his zeal for fusion cuisines to this restaurant, pioneering cross-cultural culinary connections.</p>
                            </div>
                        </div>
                    </div>
                    <div class="card">
                        <div class="card-header" role="tab" id="dannyhead">
                            <h3 class="mb-0">
                                <a data-toggle="collapse" data-target="#danny">
                                    <h3>Dhanasekaran Witherspoon <small>Chief Food Officer</small></h3>
                                </a>
                            </h3>
                        </div>
                        <div role="tabpanel" class="collapse show" id="danny" data-parent="#accordion">
                            <div class="d-none d-sm-block">
                                <p>Our CFO, Danny, as he is affectionately referred to by his colleagues, comes from a long established family tradition in farming and produce. His experiences growing up on a farm in the Australian outback gave him great appreciation for varieties of food sources. As he puts it in his own words, <em>Everything that runs, wins, and everything that stays, pays!</em></p>
                            </div>
                        </div>
                    </div>
                    <div class="card">
                        <div class="card-header" role="tab" id="agumbeheader">
                            <h3 class="mb-0">
                                <a data-toggle="collapse" data-target="#agumbe">
                                    <h3>Agumbe Tang <small>Chief Taste Officer</small></h3>
                                </a>
                            </h3>
                        </div>
                        <div role="tabpanel" class="collapse show" id="agumbe" data-parent="#accordion">
                            <div class="d-none d-sm-block">
                                <p>Blessed with the most discerning gustatory sense, Agumbe, our CTO, personally ensures that every dish that we serve meets his exacting tastes. Our chefs dread the tongue lashing that ensues if their dish does not meet his exacting standards. He lives by his motto, <em>You click only if you survive my lick.</em></p>
                            </div>
                        </div>
                    </div>
                    <div class="card">
                        <div class="card-header" role="tab" id="albertoheader">
                            <h3 class="mb-0">
                                <a data-toggle="collapse show" data-target="#alberto">
                                    <h3>Alberto Somayya <small>Executive Chef</small></h3>
                                </a>
                            </h3>
                        </div>
                        <div role="tabpanel" class="collapse" id="alberto" data-parent="#accordion">
                            <div class="d-none d-sm-block">
                                <p>Award winning three-star Michelin chef with wide International experience having worked closely with whos-who in the culinary world, he specializes in creating mouthwatering Indo-Italian fusion experiences. He says, <em>Put together the cuisines from the two craziest cultures, and you get a winning hit! Amma Mia!</em></p>
                            </div>
                        </div>
                    </div>
                </div>   
            </div>
        </div>

And following is a visual demo when you initially open the page. As you can see, the panels are collapsed, not as expected.

Then I deleted the “show” class, the cards are shrunk.

      <div class="row row-content">
            <div class = "col">
                <h2>Corporate Leadership</h2>
                
                <div id="accordion">
                    <div class="card">
                        <div class="card-header" role="tab" id="peterhead">
                            <h3 class="mb-0">
                                <a data-toggle="collapse" data-target="#peter">
                                    Peter Pan <small>Chief Epicurious Officer</small>
                                </a>
                            </h3>
                        </div>
                        <div role="tabpanel" class="collapse" id="peter" data-parent="#accordion">
                            <div class="d-none d-sm-block">
                                <p>Our CEO, Peter, credits his hardworking East Asian immigrant parents who undertook the arduous journey to the shores of America with the intention of giving their children the best future. His mother's wizardy in the kitchen whipping up the tastiest dishes with whatever is available inexpensively at the supermarket, was his first inspiration to create the fusion cuisines for which <em>The Frying Pan</em> became well known. He brings his zeal for fusion cuisines to this restaurant, pioneering cross-cultural culinary connections.</p>
                            </div>
                        </div>
                    </div>
                    <div class="card">
                        <div class="card-header" role="tab" id="dannyhead">
                            <h3 class="mb-0">
                                <a data-toggle="collapse" data-target="#danny">
                                    <h3>Dhanasekaran Witherspoon <small>Chief Food Officer</small></h3>
                                </a>
                            </h3>
                        </div>
                        <div role="tabpanel" class="collapse" id="danny" data-parent="#accordion">
                            <div class="d-none d-sm-block">
                                <p>Our CFO, Danny, as he is affectionately referred to by his colleagues, comes from a long established family tradition in farming and produce. His experiences growing up on a farm in the Australian outback gave him great appreciation for varieties of food sources. As he puts it in his own words, <em>Everything that runs, wins, and everything that stays, pays!</em></p>
                            </div>
                        </div>
                    </div>
                    <div class="card">
                        <div class="card-header" role="tab" id="agumbeheader">
                            <h3 class="mb-0">
                                <a data-toggle="collapse" data-target="#agumbe">
                                    <h3>Agumbe Tang <small>Chief Taste Officer</small></h3>
                                </a>
                            </h3>
                        </div>
                        <div role="tabpanel" class="collapse" id="agumbe" data-parent="#accordion">
                            <div class="d-none d-sm-block">
                                <p>Blessed with the most discerning gustatory sense, Agumbe, our CTO, personally ensures that every dish that we serve meets his exacting tastes. Our chefs dread the tongue lashing that ensues if their dish does not meet his exacting standards. He lives by his motto, <em>You click only if you survive my lick.</em></p>
                            </div>
                        </div>
                    </div>
                    <div class="card">
                        <div class="card-header" role="tab" id="albertoheader">
                            <h3 class="mb-0">
                                <a data-toggle="collapse" data-target="#alberto">
                                    <h3>Alberto Somayya <small>Executive Chef</small></h3>
                                </a>
                            </h3>
                        </div>
                        <div role="tabpanel" class="collapse" id="alberto" data-parent="#accordion">
                            <div class="d-none d-sm-block">
                                <p>Award winning three-star Michelin chef with wide International experience having worked closely with whos-who in the culinary world, he specializes in creating mouthwatering Indo-Italian fusion experiences. He says, <em>Put together the cuisines from the two craziest cultures, and you get a winning hit! Amma Mia!</em></p>
                            </div>
                        </div>
                    </div>
                </div>   
            </div>
        </div>

When clicking on one of the cards, the card will collapse as in the following photo

Leave a Reply

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