Bootstrap 可以把可折叠的图标放在文本的左边吗?现在它在右边

ovfsdjhp  于 2022-12-07  发布在  Bootstrap
关注(0)|答案(1)|浏览(136)

编码:

<div class="panel panel-default">
    <div class="panel-heading collapsed" data-toggle="collapse" data-target="#collapseOrderItems1"> Products 1 <i class="chevron fa fa-fw" ></i></div>
    <div class="collapse" id="collapseOrderItems1">
        <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
    </div>
  <div class="panel-heading collapsed" data-toggle="collapse" data-target="#collapseOrderItems2"> Products 2 <i class="chevron fa fa-fw" ></i></div>
    <div class="collapse" id="collapseOrderItems2">
        <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
    </div>
</div>

.panel-heading .chevron:after {
    content: "\f078";   
}
.panel-heading.collapsed .chevron:after {
    content: "\f054"; 
}

密码:https://codepen.io/anon/pen/PPxOJX
我不确定这是否可行。我只能移动整个块。我在移动可折叠图标时遇到了麻烦。

lyfkaqu1

lyfkaqu11#

您可以更新HTML代码,将图标放在文本之前:

<div class="panel-heading collapsed" data-toggle="collapse" data-target="#collapseOrderItems1"> <i class="chevron fa fa-fw" ></i> Products 1 </div>

相关问题