html - 如何反转 ul -> li 中的两个元素位置

标签 html angular css

我正在使用 ng-multiselect-dropdown 库来创建具有多选选项(复选框和标签)的下拉列表。如图所示,一切正常。

enter image description here

<div>
<ul class="item2" style="max-height: 197px;">
    <li class="multiselect-item-checkbox ng-star-inserted" style="">
        <input aria-label="multiselect-item" type="checkbox">
        <div>test3</div>
    </li>
    <li class="multiselect-item-checkbox ng-star-inserted" style="">
        <input aria-label="multiselect-item" type="checkbox">
        <div>test1</div>
    </li>
</ul>
</div>

我需要在 RTL 模式下反转元素。我尝试添加如下属性:direction="rtl";, display: flex;, flex-direction: row-reverse; , flex-wrap: wrap;

但我无法设法反转元素。

简而言之,我正在努力实现以下目标:

enter image description here

非常感谢您。

最佳答案

这是一个jsbin:https://jsbin.com/hijagigave/1/edit?html,css,output

如果我在祖先上显式设置属性 dir,它似乎可以与 li 上的 flex-direction: row; 一起使用。

.multiselect-item-checkbox {
  display: flex;
  flex-direction: row;
}

关于html - 如何反转 ul -> li 中的两个元素位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54329299/

相关文章:

html - Bootstrap 用列填充空白空间

php - 表格显示问题;尴尬的行显示

Angular4 - 新产品数量(数量)不与之前的数量相加

angular - ng2-smart-table 在编辑单击时打开弹出窗口

html - 路径目录不起作用?

html - phonegap - 在黑莓上启动屏幕后显示黑屏

html - 屏幕分辨率和图像大小,如何正确

javascript - 无法在 Angular 4 中通过 http.post() 发布变量

javascript - 如何在 jQuery Mobile 中动态创建选择菜单?

html - 页眉背景不继承设置的高度