除非我误解了这个问题,否则我认为CSS 是可能的,因为我希望从这个jsfiddle中可以清楚地看到.
示例HTML
<div class="container one">
<div class="half">Hello there.</div>
</div>
<div class="container two">
<div class="half">Hello there, you old dog.</div>
</div>
<div class="container three">
<div class="half">Hello there you old dog. Been up to your old tricks?</div>
</div>
Run Code Online (Sandbox Code Playgroud)
CSS
.container {
position: absolute;
}
.half {
position: relative;
right: 50%;
}
.two {
top: 30px;
}
.three {
top: 60px;
}
Run Code Online (Sandbox Code Playgroud)