英文:
How to list a ul li from the right to the left
问题
如何使用ul、li将红色块中的部分从右到左列出?我尝试了align-items,但它不起作用。
这是我的当前屏幕:
这是我的代码:
<b-card class="book-room" style="height:85px">
  <b-row>
    <b-col cols="5" style="justify-content: left">
      <ul style="list-style: none; margin-left: -45px; margin-top:-10px">
        <li style="font-size: 10px; color: #b5b5c3">NHẬN PHÒNG</li>
        <li style="font-weight: 700; font-size: 16px; color: #111827">
          22/10/2022
        </li>
        <li style="font-size: 12px; color: #6b7280">12:00</li>
      </ul>
    </b-col>
    <b-col cols="2" class="col-moon">
      <!-- icon -->
      <b-icon icon="moon"></b-icon>2
    </b-col>
    <b-col cols="5" style="justify-content: right">
      <ul style="list-style: none; margin-left: 26px; margin-top:-10px;">
        <li style="font-size: 10px; color: #b5b5c3;">TRẢ PHÒNG</li>
        <li style="font-weight: 700; font-size: 16px; color: #111827">
          24/10/2022
        </li>
        <li style="font-size: 12px; color: #6b7280">23:59</li>
      </ul>
    </b-col>
  </b-row>
</b-card>
谢谢!
1: https://i.stack.imgur.com/RwQZy.png
2: https://i.stack.imgur.com/x7nLP.png
英文:
I'm using Bootstrap Vue to create a layout like this: 
How can I list the part in the red block from the right to the left using ul, li? I have tried align-items but it doesn't work.
This is my current screen:
<hr>
Here is my code:
          <b-card class="book-room" style="height:85px">
            <b-row>
              <b-col cols="5" style="justify-content: left">
                <ul style="list-style: none; margin-left: -45px; margin-top:-10px">
                  <li style="font-size: 10px; color: #b5b5c3">NHẬN PHÒNG</li>
                  <li style="font-weight: 700; font-size: 16px; color: #111827">
                    22/10/2022
                  </li>
                  <li style="font-size: 12px; color: #6b7280">12:00</li>
                </ul>
              </b-col>
              <b-col cols="2" class="col-moon">
                <!-- icon -->
                <b-icon icon="moon"></b-icon>2
              </b-col>
              <b-col cols="5" style="justify-content: right">
                <ul style="list-style: none; margin-left: 26px; margin-top:-10px;">
                  <li style="font-size: 10px; color: #b5b5c3;">TRẢ PHÒNG</li>
                  <li style="font-weight: 700; font-size: 16px; color: #111827">
                    24/10/2022
                  </li>
                  <li style="font-size: 12px; color: #6b7280">23:59</li>
                </ul>
              </b-col>
            </b-row>
          </b-card>
Thank you!
答案1
得分: 1
最简单的方法就是使用 text-align: right;。它会将文本对齐到右侧,这在阅读时已经很容易理解了。
以下是一个示例,将有所帮助:
ul {
  /* 仅用于显示边框 */
  width: 100px;
  border: 1px solid;
  /* 到这里为止 */
  text-align: right;
}
<ul>
  <li>Just</li>
  <li>A</li>
  <li>Random</li>
  <li>Text</li>
</ul>
英文:
The easiest method for this is just to use text-align: right;. It will align the text to the right, which is understandable already when reading it.
Here's an example which will help:
<!-- begin snippet: js hide: false console: true babel: false -->
<!-- language: lang-css -->
ul {
  /* Just to show the box */
  width: 100px;
  border: 1px solid;
  /* Till here */
  
  text-align: right;
}
<!-- language: lang-html -->
<ul>
  <li>Just</li>
  <li>A</li>
  <li>Random</li>
  <li>Text</li>
</ul>
<!-- end snippet -->
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。



评论