CSS: How do yo get 4 spans to line up to the right?

How do yo get 4 spans to line up to the right?
Default is aligning to the left. I need them to the right.

Thank you, Bill
LVL 2
BILL CarlisleAPEX DeveloperAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

James BilousSoftware EngineerCommented:
In the css for a container you can simply apply a float:right rule which will float all of the contents to the right.
BILL CarlisleAPEX DeveloperAuthor Commented:
but then the labels don't line up
BILL CarlisleAPEX DeveloperAuthor Commented:
Here is an example:
Buget       $358,000.02
Buget               $136.21

<div id="BUGET" style="float:left; margin-left:20px">
   <div id="P_BUGET_CONTAINER">
      <label for="P_BUGET" >Buget</label>
      <div ><span id="P_BUGET">$358,000.02</span>
         <span data-item-id="P_BUGET"></span>
      </div>
   </div>
   <div id="P_TRAN_CONTAINER">
      <label for="P_TRAN" >Buget</label>
      <div ><span id="P_TRAN">$136.21</span>
         <span data-item-id="P_TRAN"></span>
      </div>
   </div>
</div>

Open in new window

Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

RobOwner (Aidellio)Commented:
You use a table: http://jsbin.com/puhihe/edit?html,css,output

<table>
  <tr>
    <td>Budget</td>
    <td>$358,000.02</td>
  </tr>
  <tr>
    <td>Budget</td>
    <td>$136.21</td>
  </tr>
</table>

Open in new window


tr td:last-child {
  text-align: right;
}

Open in new window


If you don't want to use a table then you need to set the parent containers to the same width.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
RobOwner (Aidellio)Commented:
You can also use bootstrap: http://jsbin.com/velelu/edit?html,output

<!DOCTYPE html>
<html lang="en">
  <head>
    <script src="https://code.jquery.com/jquery-1.11.3.js"></script>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
    <title>Bootstrap 101 Template</title>

    <!-- Bootstrap -->
    <!-- Latest compiled and minified CSS -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">

    <!-- Optional theme -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css">

    <!-- Latest compiled and minified JavaScript -->
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
  </head>
  <body>
    <div class="container">
      <div class="row">
        <div class="col-xs-6 col-sm-4">
          <div class="row">
            <div class="col-xs-2">Budget</div>
            <div class="col-xs-10"><span class="pull-right">$358,000.02</span></div>
          </div>
          <div class="row">
            <div class="col-xs-2">Budget</div>
            <div class="col-xs-10"><span class="pull-right">$136.21</span></div>
          </div>
        </div>
      </div>
    </div>
  </body>
</html>

Open in new window

Julian HansenCommented:
Just put them in a container with a style to align text right.
<div style="text-align: right">
  <span> span1</span>
  <span> span2</span>
  <span> span3</span>
  <span> span4</span>
</div>

Open in new window


Sample here
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
CSS

From novice to tech pro — start learning today.