1

我知道你可以让我们说一个距左侧 50 像素的标题。但是你能从另一个标题做 50 像素的东西吗?不只是从边缘?就像标题 2 需要距离标题 1 50 像素一样。我该怎么做?

4

2 回答 2

1

使它们都内联块并在第一个块上添加 50px 边距。

<style>h1, h2 { display: inline-block; margin-right: 50px; }</style>
<h1>my thing</h1>
<h2>my other thing<h2>

请参阅此示例:http: //jsfiddle.net/bpR7H/

注意:您需要避免position: absolute这样做才能正常工作,因为绝对定位的元素不会影响其他元素的位置。

于 2012-12-02T06:16:06.500 回答
0

http://jsfiddle.net/w9FHw/

类似的东西?

#rightheading {
    position: relative;
    left: 50px
}
于 2012-12-02T06:17:46.523 回答