I'm currently working on creating a customized right-aligned accordion using Bootstrap CSS and JS library. Bootstrap accordions consist of two main components: headers (which include a button) and bodies. Here is the code snippet I have implemented so far:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>BootStrap</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="dfbdb0b0abacabadbeaf9feaf1eff1eff2bdbaabbeed">[email protected]</a>/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BmbxuPwQa2lc/FVzBcNJ7UAyJxM6wuqIj61tLrc4wSX0szH/Ev+nYRRuWlolflfl" crossorigin="anonymous">
<link href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="95f7fafae1e6e1e7f4e5d5a0bba5bba5b8f7f0e1f4a7">[email protected]</a>/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BmbxuPwQa2lc/FVzBcNJ7UAyJxM6wuqIj61tLrc4wSX0szH/Ev+nYRRuWlolflfl" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
...
body{
margin: 50px;
}
.accordion, .accordion-button, .accordion-header{
text-align: right
}
</style>
</head>
<body>
<div class="accordion" id="accordionExample">
...
In order to align both the header and body parts to the right side, I added the following CSS code within the <style>
tag:
<style>
.accordion, .accordion-button, .accordion-header {
text-align: right
}
</style>
Although it successfully aligned the body section, the header remained unaffected: Any suggestions on how I can resolve this issue?