【发布时间】:2019-11-26 21:30:00
【问题描述】:
我有一个例子:https://jsfiddle.net/e9ozyj0w/
我想让字母 g、o、  和 n 与它们的 div 底部对齐,而完成 owhere 与它们对齐。
我该怎么做? (我已经尝试过vertical-align、text-align 和bottom: 0。)
附:一个最小的可重现示例是:
html:
<div class="input">
<div class="char">g</div>
<div class="char">o</div>
<div class="char"> </div>
<div class="char">n</div>
<div class="completions">
<div>orth</div>
<div>orthwards</div>
<div>owhere</div>
</div>
</div>
css:
div.input {
position: absolute;
bottom: 0px;
display: flex;
}
div.prefix {
display: flex;
}
div.completion {
position: relative;
}
div.char {
bottom: 0px;
}
它产生:
go north
orthwards
owhere
我想要:
orth
orthwards
go nowhere
【问题讨论】:
-
How to ask 您需要在此处发布minimal reproducible example,在您的问题中,而不是任何第三方网站。
-
我不确定你想做什么?但我做了一些实验,请评论:->codepen.io/jaydeeep/pen/QWWXvOj
-
@jaydeeppatel 感谢您的帮助,但我刚刚在问题中添加了我想要的内容。
-
你为什么要这样拆分单词?它完全无法访问,并且会损害您的 seo 排名,因为它没有合适的词来搜索
-
@Pete 这是一个自定义的 html 输入组件,需要单独为字符着色/样式。我可能会将具有相同风格的角色分组。
标签: css text-align