将锚点向右对齐 [英] Align an anchor to the right

查看:88
本文介绍了将锚点向右对齐的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请考虑以下内容:

<a>a</a><a>b</a>

如何将第二个锚点(b)对准右边?

How Can I align the second anchor (b) to the right ?

PS:在这种情况下,float是一种滥用,并非出于此目的,并且会引起一些问题,因此我需要其他更合理的解决方案.

PS : float is an abuse in this situation, it's not made for this and it causes some problems, so I need other more reasonable solution.

推荐答案

您需要单独的容器.

<p>
    <span>
        <a>Left</a>
    </span>
    <span class="align-right">
        <a>Right</a>
    </span>
</p>

p {font-size:0; /* Fixes inline block spacing */  }
span { width:50%; display:inline-block; }
span.align-right { text-align:right; }

span a { font-size:16px; }

JSFiddle示例.

这篇关于将锚点向右对齐的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆