I am currently working on integrating a FAQ section into my website (not yet live, so I cannot provide a link). However, I am facing some minor CSS issues that I am struggling to resolve. The problem lies in a panel that is meant to display as shown below:
https://i.sstatic.net/qgrKb.png
Issue #1:
- There is no clear separation between the icon and the text (refer to the image). The title can vary in length.
- When the title is long and spans multiple lines, the icon fails to stay centered and shifts downwards (refer to the image).
How can I divide the Title into two parts, where one part is centrally aligned with respect to the height and width of the icon? Any suggestions would be greatly appreciated.
.btn,
.btn:hover,
.btn:focus,
.btn:active,
.btn:active:focus {
outline: 0;
}
.btn-custom {
margin-bottom: 1em;
}
.no-margin {
margin: 0;
}
.no-padding {
padding: 0;
}
.no-border {
border: 0;
}
.no-radius {
border-radius: 0;
}
/*** Content ***/
main {}
.i-row {
padding-top: 40px;
padding-bottom: 40px;
}
.i-row-odd {
background-color: #ffffff;
}
.i-row-even {
background-color: #f7f7f7;
}
.section-title {
margin-top: 0;
margin-bottom: 0.6em;
font-weight: 500;
}
.section-title .fa {
margin-right: 5px;
color: #6f5499;
}
.i-accordion .panel-heading,
.d-accordion .panel-heading,
.accordion-2a .panel-heading,
.accordion-2b .panel-heading,
.accordion-3 .panel-heading {
cursor: pointer;
}
.d-accordion .panel-heading.collapsed .fa-chevron-up:before {
content: '\f078';
}
.panel-success>.panel-heading {
background-color: transparent;
border-color: transparent;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u"
crossorigin="anonymous">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css" integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/"
crossorigin="anonymous">
<div class="col-md-6">
<div class="panel-group i-accordion">
<div class="panel panel-success">
<div class="panel-heading" data-toggle="collapse" data-parent=".i-accordion" href="#aboutus3">
<h4 class="panel-title">test<i class="fa fa-chevron-right pull-left"></i></h4>
</div>
<div id="aboutus3" class="panel-collapse collapse">
<div class="panel-body">
<p>answer</p>
</div>
</div>
</div>
// More similar code snippets go here..
</div>
</div>
Resolved Issue: https://i.sstatic.net/n1BNO.png
The problem has been successfully fixed, although there are still a few remaining minor challenges:
- The title and the icon are now divided, but I require additional space for the icon.
- The icon continues to shift downward slightly when the title expands beyond one line.
Your continued assistance is much appreciated!