javascript - 将英语句子的翻译定位在右边缘
问题描述
我有一个英文句子及其下方的 RTL 句子翻译:
<div class="sample-sentence">
<p class="eng">I could make up a bed for you on the sofa.</p>
<p class="rtl">برات آماده کنم</p>
</div>
到目前为止,我只能将 RTL 句子定位在英语句子的最左侧或中间。
如何将 RTL 句子定位在英文句子的右边缘,如下所示:
解决方案
grid
并且justify-content
可能会有所帮助:
.sample-sentence {
display: grid;
justify-content: start;
}
/* snippet demo purpose */
body>p {text-align:center;background:none;}
p {margin:0;background:#bee}
<div class="sample-sentence">
<p class="eng">I could make up a bed for you on the sofa.</p>
<p dir="rtl">برات آماده کنم</p>
</div>
<hr>
<p>no matter the initial direction of the doc</p>
<hr>
<div dir="rtl" >
<div class="sample-sentence">
<p>برات آماده کنم</p>
<p dir="ltr" class="eng">I could make up a bed for you on the sofa.</p>
</div>
</div>
推荐阅读
- python - 如何在 python 中包含带有 bdist_wheel 的外部 shell 脚本?
- php - 带有占位符的 Symfony 翻译不起作用
- c# - 如何使用结构上的 ref 修改值。C#
- python - Old PyMC3 style grouping traceplot plotted with Arviz
- javascript - 如何选择具体
- javascript - django websocket连接在js控制台中的web socket握手期间失败
- mysql - MySQL:用另一列的数据更新列
- datadog - Datadog 监控器在一个指标自另一指标以来的一段时间内未发生时发出警报
- angular - 在发布请求中使用带有地图的 ForkJoin - 角度 8
- mysql - 如何从 MySQL 中的列中拆分逗号分隔值?