Twitter bootstrap好角落文本/图像

时间:2012-06-13 23:25:56

标签: css twitter-bootstrap

我有一个好的div,我想在角落附上一个小的文字/图像,如图所示(http://draw.to/D46BqsC)...并将该元素相对于井放置,以便它改变了井的位置。什么是最好的方法?谢谢!

1 个答案:

答案 0 :(得分:3)

您可以使用position: absolute将元素定位在相对于其父元素的绝对位置(在本例中为井)。唯一的问题是父元素必须是静态的,否则你的井可能需要包含在其他东西中。

.my-well {
    position: relative;
}

.my-well span {
    position: absolute;
    top: 0;
    right: 0;
}

<div class="well my-well">
    <span>xxx</span>
</div>​

http://jsfiddle.net/YPcLy/