Khant Thu Linn
Khant Thu Linn

Reputation: 6133

Aligning in bootstrap with accordion

I am beginner in bootstrap. I am designing simple FAQ page with bootstrap like this.

enter image description here

This is my style. I try to change position, margin but I can't manage to shorten title and arrow to be middle. How shall I do?

<style>
 .faqHeader {
    font-size: 27px;
    margin: 20px;
}

.panel-heading [data-toggle="collapse"]:after {
    font-family: 'Glyphicons Halflings';
    content: "\e072"; /* "play" icon */
    float: right;
    color: #F58723;
    font-size: 18px;
    line-height: 22px;
    /* rotate "play" icon from > (right arrow) to down arrow */
    -webkit-transform: rotate(-90deg);
    -moz-transform: rotate(-90deg);
    -ms-transform: rotate(-90deg);
    -o-transform: rotate(-90deg);
    transform: rotate(-90deg);

}



.panel-heading [data-toggle="collapse"].collapsed:after {
    /* rotate "play" icon from > (right arrow) to ^ (up arrow) */
    -webkit-transform: rotate(90deg);
    -moz-transform: rotate(90deg);
    -ms-transform: rotate(90deg);
    -o-transform: rotate(90deg);
    transform: rotate(90deg);
    color: #454444;

}
</style>


<div class="panel panel-default">
    <div class="panel-heading">
        <h4 class="panel-title">
            <a class="accordion-toggle collapsed" data-toggle="collapse" data-parent="#accordion" href="#collapseSeven">How did the Self Assessment Test come about?</a>
        </h4>
    </div>
    <div id="collapseSeven" class="panel-collapse collapse">
        <div class="panel-body">
                The Skill Optimiser Project Team has worked with all the Hiring Managers for the various job roles to understand the requirement based on 4 aspects: Product Knowledge, Job Expertise Knowledge/ Skills, Education/ Experience, and Competencies.
        </div>
    </div>
</div>

Upvotes: 2

Views: 124

Answers (1)

Bendy Zhang
Bendy Zhang

Reputation: 501

You can try to add following code to your styles:

.panel-heading [data-toggle="collapse"] {
    position: relative;
    display: block;
}
.panel-heading [data-toggle="collapse"]:after {
    position: absolute;
    right: 15px;
    top: 5px;
    float: right;  /*remove it*/
}

Using position instead of float: right. Remove your float:right.

According to your attached zip. I changed your styles in index.html as below. It worked.

.faqHeader {
    font-size: 27px;
    margin: 20px;
}
.panel-heading [data-toggle="collapse"] {
    display: block;
    position: relative;
    padding-right: 20px;
}
.panel-heading [data-toggle="collapse"]:after {
    position: absolute;
    top: 0;
    right: 0;
    font-family: 'Glyphicons Halflings';
...

enter image description here

Upvotes: 1

Related Questions