如何将 ul li 从右到左列出

huangapple go评论46阅读模式
英文:

How to list a ul li from the right to the left

问题

我正在使用Bootstrap Vue创建这样的布局:如何将 ul li 从右到左列出

如何使用ul、li将红色块中的部分从右到左列出?我尝试了align-items,但它不起作用。

这是我的当前屏幕:

如何将 ul li 从右到左列出


这是我的代码:

<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: 如何将 ul li 从右到左列出

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:

如何将 ul li 从右到左列出

<hr>

Here is my code:

          &lt;b-card class=&quot;book-room&quot; style=&quot;height:85px&quot;&gt;
            &lt;b-row&gt;
              &lt;b-col cols=&quot;5&quot; style=&quot;justify-content: left&quot;&gt;
                &lt;ul style=&quot;list-style: none; margin-left: -45px; margin-top:-10px&quot;&gt;
                  &lt;li style=&quot;font-size: 10px; color: #b5b5c3&quot;&gt;NHẬN PH&#210;NG&lt;/li&gt;
                  &lt;li style=&quot;font-weight: 700; font-size: 16px; color: #111827&quot;&gt;
                    22/10/2022
                  &lt;/li&gt;
                  &lt;li style=&quot;font-size: 12px; color: #6b7280&quot;&gt;12:00&lt;/li&gt;
                &lt;/ul&gt;
              &lt;/b-col&gt;

              &lt;b-col cols=&quot;2&quot; class=&quot;col-moon&quot;&gt;
                &lt;!-- icon --&gt;
                &lt;b-icon icon=&quot;moon&quot;&gt;&lt;/b-icon&gt;2
              &lt;/b-col&gt;

              &lt;b-col cols=&quot;5&quot; style=&quot;justify-content: right&quot;&gt;
                &lt;ul style=&quot;list-style: none; margin-left: 26px; margin-top:-10px;&quot;&gt;
                  &lt;li style=&quot;font-size: 10px; color: #b5b5c3;&quot;&gt;TRẢ PH&#210;NG&lt;/li&gt;
                  &lt;li style=&quot;font-weight: 700; font-size: 16px; color: #111827&quot;&gt;
                    24/10/2022
                  &lt;/li&gt;
                  &lt;li style=&quot;font-size: 12px; color: #6b7280&quot;&gt;23:59&lt;/li&gt;
                &lt;/ul&gt;
              &lt;/b-col&gt;
            &lt;/b-row&gt;
          &lt;/b-card&gt;

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 -->

&lt;ul&gt;
  &lt;li&gt;Just&lt;/li&gt;
  &lt;li&gt;A&lt;/li&gt;
  &lt;li&gt;Random&lt;/li&gt;
  &lt;li&gt;Text&lt;/li&gt;
&lt;/ul&gt;

<!-- end snippet -->

huangapple
  • 本文由 发表于 2023年2月6日 10:18:44
  • 转载请务必保留本文链接:https://go.coder-hub.com/75356815.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定