如何让我的 CSS 滑出元素推送其相邻内容?

发布于 2024-12-29 18:31:10 字数 253 浏览 2 评论 0原文

我使用 CSS 制作了一个滑出元素(在页脚中,图片旁边的左下角),并希望当其悬停并滑出时将图片和描述推到右侧。我已经把它们全部定位为相对的,我错过了什么吗?

对尝试编码相当陌生,所以希望这个问题有意义。

谢谢!

以下是该网站的链接:http://mirandascomplicated.tumblr.com/

I've made a slide-out element using CSS (in the footer, bottom left next to the picture) and would like for it to push the picture and the description to the right, when its hovered over and slid-out. I've made them all position:relative, am I missing something?

Quite new to trying to code, so hopefully the question makes sense.

Thanks!

Here's the link to the site: http://mirandascomplicated.tumblr.com/

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

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

发布评论

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

评论(1

林空鹿饮溪 2025-01-05 18:31:10

它不起作用,因为 #slideout 元素没有更改其宽度。它固定为 20px。

此外,#slideout_inner div 正在通过更改其左侧(正确?)位置来滑出。这不起作用,因为相对元素的左/右/上/下定位实际上不会影响它使用的空间(因此不会使父元素更宽),它只会影响它的位置显示。尝试对其左边距、填充或宽度进行动画处理。

It doesn't work because the #slideout element is not changing its width. It is fixed to 20px.

Additionally, the #slideout_inner div is being slid out by changing its left (correct?) position. This wont work because the left/right/top/bottom positioning of a relative element doesn't actually affect the space it uses (and therefore doesn't make the parent wider), it just affects where it is displayed. Try animating its left margin, padding or width instead.

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