在 tumblr 主题中将图像右上角对齐

发布于 2024-12-15 00:55:43 字数 290 浏览 2 评论 0原文

我正在尝试将图像与广告旁边对齐,就像damnyouauto Correct.com 所做的那样。

我将广告代码放置在标签正下方,它按预期将内容向下推送。

它拥抱左侧。接下来,我想放置一个 Twitter 关注按钮,并将其对齐并紧靠右侧。问题是,无论我做什么,它都会紧贴左侧并保持在广告的正下方。

我尝试过

margin-left: auto; 右边距:自动; float:right;

你知道我做错了什么吗?

I'm trying to align an image right next to an ad much like damnyouautocorrect.com does.

I placed the ad code right below the tag and it pushed the content down as expected.

It hugs the left side. Next, I want to place a Twitter follow button and have it align and hug the right side. The problem is no matter what I do it hugs the left side and stays right below the ad.

I've tried

margin-left: auto;
margin-right: auto;
float:right;

Any idea as to what I'm doing wrong?

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

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

发布评论

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

评论(2

拥醉 2024-12-22 00:55:43

尝试一下:

position:absolute;
right:0px;

give this a try:

position:absolute;
right:0px;
顾冷 2024-12-22 00:55:43

您发布的示例链接使用基于表格(boo)的布局。

因此,很难用您发布的少量信息说太多...但是,在我看来,问题在于拥抱左侧的元素没有 float:left;

您不能在同一“水平”线上有 2 个元素,如果其中一个元素未使用 float 属性,则每个元素都会浮动到不同的一侧。例如

左块| RIGHT BLOCK

其中 leftblock 有 {float:left;}
其中 rightblock 有 {float:right;}

并且,为了安全起见,请确保它们的组合宽度不超过父级的宽度,否则第二个将始终跳到下一行。

希望这有帮助

The sample link you posted uses a layout based on tables (boo).

So it's hard to say much with the little info you've posted...however, it sounds to me like the problem is that the element hugging the left does not have float:left;

You CANNOT have 2 elements under the same 'horizontal' line, each floated to a different side if one of either is not using the float property. For example

LEFT BLOCK | RIGHT BLOCK

Where leftblock has {float:left;}
Where rightblock has {float:right;}

And, to play it safe, make sure their combined width's do not exceed the parent's width or else the second one will always jump to the next line.

Hope this helps

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