gpt4 book ai didi

css - 需要两个 block 在文本的右侧对齐 - 可能吗?

转载 作者:行者123 更新时间:2023-11-28 14:40:18 28 4
gpt4 key购买 nike

一直在使用 sprite 优化一些东西并遇到了这个问题......我需要将两个 block 与文本的右侧对齐,但无论我做什么,它们都会在其下方的新行上开始左对齐。使用 position:absolute 似乎在我的编辑器中有效,但在发布时却无效。

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<style type="text/css">
a.facebook{margin:0 5px 0 0;float:left;display:block;width:30px;height:30px;background:url(social.png) no-repeat 0 0;background-position:0px -38px;overflow:hidden;text-indent:-10000px;font-size:0px;line-height:0px;}
a.twitter{margin:0 5px 0 0;float:left;display:block;width:30px;height:30px;background:url(social.png) no-repeat 0 0;background-position:-30px -38px;overflow:hidden;text-indent:-10000px;font-size:0px;line-height:0px;}
</style>
</head>

<body>
<div>this is a test
<a href="#" onclick="window.open('http://test.com')" title="Find us on Facebook!" class="facebook">Find us on Facebook!</a>
<a href="#" onclick="window.open('http://test.com')" title="Find us on Twitter!" class="twitter">Find us on Twitter</a></div>
</body>
</html>

最佳答案

如果我有问题,我想你正在寻找 float:right,但请注意, float 相对于跟随它们的元素 float ,所以你需要将链接放在文本之前。

编辑:更多数据如果您希望将 block 插入到其他元素中,就像它们是文本的一部分一样,您应该制作它们的 display:inline-block (在 IE6 中,这仅适用于默认情况下内联的元素)。但随后它们会出现在插入的位置,而不是 float 。

关于css - 需要两个 block 在文本的右侧对齐 - 可能吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6078122/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com