html - 确保内联项始终出现在最后

标签 html css

我正在实现一个 HTML 消息对话框。

enter image description here

收件人输入面板如上所示 - 一些收件人,以及末尾的文本框(不可见),用于通过自动完成菜单添加新收件人。

我目前将其实现为内联显示的无序列表:

<ul class="recipients inline clearfix">
    <li class="recipient"><span>recipient 1<a href="#" class="remove">x</a></span></li>
    <li class="recipient"><span>recipient 2<a  href="#" class="remove">x</a></span></li>
    <li class="recipient last"><span>recipient 3<a  href="#" class="remove">x</a></span></li>
    <li class="searchbox"><input type="text" class="search-recipient"></li>
</ul>

ul.inline li {
    display: inline;
    list-style-type: none;
}

问题是当收件人进入多行时,文本框会向上移动以填充可用空间:

enter image description here

如何让文本框始终显示在收件人之后?

最佳答案

您提供的代码应该可以正常工作。您可能在输入框上设置了某种 float 。

参见 Live Example

关于html - 确保内联项始终出现在最后,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10623094/

相关文章:

html - 如何使用 CSS 应用渐变?

html - 更改事件输入选择器的背景颜色

PHP 解析错误 : syntax error, 意外的 T_CLASS

css - 使用react-transition-group作为子组件接收新的 Prop

html - 宽度为百分比的 `position:fixed` 侧边栏?

html - 试图将我的图像定位得低一点,但它会把所有东西都拖下来

html - vuejs 中的 v-for 动态图像网格逻辑

css - IE 不渲染背景图片

javascript - 为什么我的 jQuery 效果不像它所说的那样执行?

CSS:有没有办法定义总文档高度?