简单的html代码可以正常工作并显示一组行:
<div class="card">
<div class="card-block">
<ul class="list-group" role="group" aria-label="Basic example">
<li class="rotated list-group-item d-flex">Primary</li>
<li class="rotated list-group-item d-flex">Secondary</li>
<li class="rotated list-group-item d-flex">Success</li>
<li class="rotated list-group-item d-flex">Info</li>
<li class="rotated list-group-item d-flex">Warning</li>
<li class="rotated list-group-item d-flex">Danger</li>
</ul>
</div>
</div>
当我添加以下CSS时,列表项变为垂直,但全部堆叠在一起。
.rotated {
-ms-transform: rotate(270deg); /* IE 9 */
-webkit-transform: rotate(270deg); /* Chrome, Safari, Opera */
transform: rotate(270deg);
}
如何解决这种情况,以便项目正确显示为列而不是行。 谢谢!
.card-deck {
height: 200px;
}
.rotated {
-ms-transform: rotate(270deg); /* IE 9 */
-webkit-transform: rotate(270deg); /* Chrome, Safari, Opera */
transform: rotate(270deg);
}
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<div class="container">
<div class="card-deck">
<div class="card">
<div class="card-block">
<ul class="list-group" role="group" aria-label="Basic example">
<li class="rotated list-group-item d-flex">Primary</li>
<li class="rotated list-group-item d-flex">Secondary</li>
<li class="rotated list-group-item d-flex">Success</li>
<li class="rotated list-group-item d-flex">Info</li>
</ul>
</div>
</div>
</div>
</div>
答案 0 :(得分:0)
只是想通了。我将旋转的类改为列表组:)
<div class="card">
<div class="card-block">
<ul class="rotated list-group" role="group" aria-label="Basic example">
<li class="list-group-item d-flex">Primary</li>
<li class="list-group-item d-flex">Secondary</li>
<li class="list-group-item d-flex">Success</li>
<li class="list-group-item d-flex">Info</li>
<li class="list-group-item d-flex">Warning</li>
<li class="list-group-item d-flex">Danger</li>
</ul>
</div>
</div>