使用 CSS 在多个框的底部创建固定文本

发布于 2024-09-30 11:23:47 字数 273 浏览 1 评论 0原文

我使用 CSS 来对齐具有标准高度的预览文章框底部的文本(这只是一个“阅读更多”链接)。 “阅读更多”链接现在显示在预告文本的正下方,我需要将其放置在文章框底线上方几个像素的位置,与文本高度无关,就像这样

___________________________
|
|
|
|
|
|              read more >>
|___________________________

你能给我一些想法或例子吗?

问候, 乔治

I am using CSS to align my text (which is just a "read more" link) at the bottom of my preview article boxes which have a standard height. The "read more" link now show up just below of the teaser text and I need to position it just a few pixels above the bottom line of the article box independently of the text height, like this

___________________________
|
|
|
|
|
|              read more >>
|___________________________

Can you please give me some ideas or examples ?

Regards,
George

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

若能看破又如何 2024-10-07 11:23:47

将您的文章元素设置为具有 position:relative,然后将阅读更多链接设置为具有 position:absolute,以便您可以将其定位在使用 bottom/right css 属性的文章。

示例位于 http://www.jsfiddle.net/gaby/7bduy/

Set your article element to have position:relative and then set the read more link to have position:absolute so that you can position it within the article using the bottom/right css properties..

example at http://www.jsfiddle.net/gaby/7bduy/

蓝眼睛不忧郁 2024-10-07 11:23:47

我已经很长时间没有使用 Javascript 了,但是在“相关”部分有一个链接可以帮助您:CSS:固定到底部并居中

I haven't used Javascript in a long time, but right on the "Related" section there's a link that may help you: CSS: fixed to bottom and centered

花开雨落又逢春i 2024-10-07 11:23:47

您可以考虑相对定位文本。

在 css 中:

#selectorName{
    position:relative;
    left: 10px;
    top:10px;
    bottom:10px;
    right:10px;
}

这将允许您在框中相对于根据文档流规则应有的位置移动链接。

You can look into positioning the text relatively.

in css:

#selectorName{
    position:relative;
    left: 10px;
    top:10px;
    bottom:10px;
    right:10px;
}

this will allow you to move the link around in the box relative to the position where it's supposed to be according to document flow rules.

新一帅帅 2024-10-07 11:23:47

如果您的文章“文本”大小固定,请执行以下操作:

<div class="article">
<div class="readmore"><a href="#">read more ></a>
</div>

CSS:

.article 
{
position relative;
width: 300px;
height: 100px;
}
.readmore
{
position:absolute;
z-index:3;
width:50px;
height:25px;
right:0px;
top:280px;
}

...或类似的操作:)

If your article 'text' is fixed size, do something like this:

<div class="article">
<div class="readmore"><a href="#">read more ></a>
</div>

CSS:

.article 
{
position relative;
width: 300px;
height: 100px;
}
.readmore
{
position:absolute;
z-index:3;
width:50px;
height:25px;
right:0px;
top:280px;
}

...or something like that :)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文