加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 资源网站 > 资源 > 正文

html – 如何将两个span元素左对齐,另一个向右对齐?

发布时间:2020-12-14 16:45:55 所属栏目:资源 来源:网络整理
导读:我有两个 span内容: span style="margin-right:auto;"?2012 XYZ Corp. All Rights Reserved./spanspan style="margin-left:auto;"Built with a href="http://www.wordpress.org/"Wordpress/a and hosted by a href="http://www.mediatemple.net/"(mt)/a in
我有两个< span>内容:
<span style="margin-right:auto;">?2012 XYZ Corp. All Rights Reserved.</span>
<span style="margin-left:auto;">Built with <a href="http://www.wordpress.org/">Wordpress</a> and hosted by <a href="http://www.mediatemple.net/">(mt)</a> in California.</span>

我想要第一个< span>位于页面左侧,第二个< span>无论页面宽度如何都在右侧(所以我不能使用固定定位).

我可以使用什么CSS来做到这一点?

解决方法

css变量float用于定位元素.

选项是:

float:left;
float:right;
float:none;
<span style="float:left;">?2012 XYZ Corp. All Rights Reserved.</span>

<span style="float:right;">Built with <a href="http://www.wordpress.org/">Wordpress</a> and hosted by <a href="http://www.mediatemple.net/">(mt)</a> in California.</span>

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读