I need to place 2 <span>
inside a <div>
, the first span must be placed on top, the second one on bottom, like North-South.
<div>
<span class="north">N</span>
<span class="south">S</span>
</div>
To do this, I thought about using position:absolute;
on the 2 <span>
.
div
{
display:inline-block;
width: 20px;
position:relative;
height:100px;
}
.north
{
position:absolute;
top:0;
}
.south
{
position:absolute;
bottom:0;
}
Now, the spans should be positioned to the left (default), to center them, I used:
div
{
text-align:center;
}
But I got this:
Check it out : http://jsfiddle.net/Zn4vB/
Why is this Happening?
Note: I cannot use margins, left, right, because the contents of those spans are different, I just need to align them properly in the center.