antonpug antonpug - 3 months ago 7
CSS Question

How do I align two span elements one to the left, the other one to the right?

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?

Answer

The css variable float is used to position your elements.

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>
Comments