html - 跨多行从同一位置开始

标签 html css

我有这样的html代码:

<span style="color:#c9caca">Scope of Work</span><span class="ga_sep"></span><span>Idea Processing, Photography, Magazine Advertising, Idea Processing, Photography, Magazine, Advertising, Idea Processing, Photography, Magazine Advertising</span>

结果是

enter image description here

但我想要这个:

enter image description here

表示跨度中的第 2 行从同一行的位置开始。

这是我的 CSS 代码,但不起作用:

.ga_sep{
    height:10px;
    width:1px;
    border-left:1px solid #c9caca;
    display:inline-block;
    margin:1px 8px 0 8px;
    position: relative;
    top:1px;
    display:inline;
}

最佳答案

例如,您可以使用 display: table 值。

<style>
.ga_sep{
    height:10px;
    width:1px;
    border-left:1px solid #c9caca;
    margin:1px 8px 0 8px;
    position: relative;
    top:1px;
    display:inline;
}
div {display: table}
span {display: table-cell}
span:first-child {white-space: nowrap}
</style>

<div>
    <span style="color:#c9caca">Scope of Work</span>
    <span class="ga_sep"></span>
    <span>Idea Processing, Photography, Magazine Advertising, Idea Processing, Photography, Magazine, Advertising, Idea Processing, Photography, Magazine Advertising</span>
</div>

http://jsfiddle.net/f7hhx5qe/1/

关于html - 跨多行从同一位置开始,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26954916/

相关文章:

javascript - 最小化 Firefox 和 Chrome 中的浏览器窗口会在页面右侧添加空白

php - 使用php将html表单中的数据插入到mysql数据库中的数据表中

javascript - 条件加载 JS - 如果在内容中预先标记

html - css中方向对齐和文本对齐的区别

html - 链接项 anchor CSS 前景色在 {} 和 :foo { } 之间的交互

html - 双边框属性导致错误

html - 在图像中旋转 View ,而不是图像本身?

php - 将多个复选框的值 POST 到 SQL

javascript - 如何使用 jquery 翻转动态添加的图像?

html - 垂直对齐相对内联 block 与非相对内联 block