I have two <span>
elements:
我有两个元素:
<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>
I want the first <span>
to be on the left of the page and the second <span>
to be on the right side, regardless of page width (so I can't use fixed positioning).
我希望第一个位于页面左侧,第二个位于右侧,无论页面宽度如何(因此我无法使用固定定位)。
What CSS can I use to do this?
我可以使用什么CSS来做到这一点?
1 个解决方案
#1
22
The css variable float
is used to position your elements.
css变量float用于定位元素。
The options are:
选项是:
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>
#1
22
The css variable float
is used to position your elements.
css变量float用于定位元素。
The options are:
选项是:
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>