user963063 user963063 - 1 year ago 58
CSS Question

How to make span left-aligned to its parent

How can I make the following span to be left-aligned with its parent, in this case, the DIV with id of “rightPanel”?

Currently, the following code displays the span content to the right with Safari browser.

<div id="rightPanel">
<span style="background-color:##ACE1AF; white-space:nowrap;">
my stuff goes here...


Answer Source

Use the following CSS:

#rightPanel {
    text-align: left;

Or, if you want to use inline styles (not recommended) as you did in your span tag:

<div id="rightPanel" style="text-align: left">