gpt4 book ai didi

html - 如何将两个 div 向右对齐,同时保持它们向左对齐

转载 作者:太空宇宙 更新时间:2023-11-04 09:07:28 25 4
gpt4 key购买 nike

我需要使 div 保持相同的对齐方式,但它们都向右对齐:我这里有一张图片:如您所见,'hello' 和 'hellooooooo' 都向右对齐,但我希望它们向左对齐。

enter image description here

所以它看起来像这样:

enter image description here

HTML

<ul class="fu-form--job-edit-details mdl-list">
<li class="mdl-list__item">
<span class="mdl-list__item-primary-content">
<span class="fu-form--job-edit-details--title">Hello:</span>
World
</span>
</li>
<li class="mdl-list__item">
<span class="mdl-list__item-primary-content">
<span class="fu-form--job-edit-details--title">Hello:</span>
World
</span>
</li>
</ul>

CSS:

.fu-form--job-edit-details {
.mdl-list__item {
color: $text-label-color;
padding: 0;
min-height: 35px;
}

.mdl-list__item-primary-content {
justify-content: flex-end;
}

.fu-form--job-edit-details--title {
font-weight: bold;
padding-right: 5px;
}
}

最佳答案

是你想要的吗?

.fu-form--job-edit-details{
float:right;
text-align: right;
}


.mdl-list__item {
color: #222;
padding: 0;
min-height: 35px;
list-style:none;
}

.mdl-list__item-primary-content {
/*justify-content: flex-end;*/
width: 100%;
}

.fu-form--job-edit-details--title {
font-weight: bold;
padding-right: 5px;
float:left;
}
<ul class="fu-form--job-edit-details mdl-list">
<li class="mdl-list__item">
<span class="mdl-list__item-primary-content">
<span class="fu-form--job-edit-details--title">Hello:</span>
World
</span>
</li>
<li class="mdl-list__item">
<span class="mdl-list__item-primary-content">
<span class="fu-form--job-edit-details--title">Hellooooooooooooooo:</span>
World
</span>
</li>
</ul>

关于html - 如何将两个 div 向右对齐,同时保持它们向左对齐,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42374171/

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