gpt4 book ai didi

html - 如何在 CSS 中将字符串 "Hello this is world"转换为 "world is this Hello"?

转载 作者:太空宇宙 更新时间:2023-11-03 21:35:42 25 4
gpt4 key购买 nike

如何使用 CSS 将字符串“Hello world I am Jack”反转为“Jack am I world Hello”?

例如:

Hello World ,我是 jack

我想知道如何使用 CSS 将其转换为

jack is this world 你好

最佳答案

假设每个词在不同的html元素中,你可以使用

display: flex;
flex-direction: row-reverse;
justify-content: flex-end;

.wrapper {
display: flex;
}
.reversed {
flex-direction: row-reverse;
justify-content: flex-end;
}
.wrapper > * {
margin: 0 .1em;
}
<div class="wrapper reversed">
<span>Hello</span>
<span>world</span>
<span>this</span>
<span>is</span>
<span>jack</span>
</div>
<div class="wrapper normal">
<span>Hello</span>
<span>world</span>
<span>this</span>
<span>is</span>
<span>jack</span>
</div>

关于html - 如何在 CSS 中将字符串 "Hello this is world"转换为 "world is this Hello"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26819724/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com