Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8931407
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T09:06:35+00:00 2026-06-15T09:06:35+00:00

I need to left, center, & right align text on the same line. I

  • 0

I need to left, center, & right align text on the same line. I have the following text:

  • Left Align: 1/10
  • Center: 02:27
  • Right Align: 100%

I wrote the following code which works for left and right aligning text but does not work correctly for the center text.

HTML

<div id="textbox">
<p class="alignleft">1/10</p>
<p class="aligncenter">02:27</p>
<p class="alignright">100%</p>
</div>
<div style="clear: both;"></div>

CSS

.alignleft {
    float: left;
}
.aligncenter {
    float: left;
}
.alignright {
    float: right;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T09:06:36+00:00Added an answer on June 15, 2026 at 9:06 am

    Try this

    UPDATED

    HTML

     <div id="textbox">
       <p class="alignleft">1/10</p>
       <p class="aligncenter">02:27</p>
       <p class="alignright">100%</p>
     </div>
     <div style="clear: both;"></div>​
    

    CSS

    .alignleft {
      float: left;
      width: 33.33333%;
      text-align: left;
    }
    .aligncenter {
      float: left;
      width: 33.33333%;
      text-align: center;
    }
    .alignright {
     float: left;
     width: 33.33333%;
     text-align: right;
    }​
    

    Demo the code here: http://jsfiddle.net/wSd32/1/
    Hope this helps!

    =======UPDATE 2021:

    You can now get the same results using HTML5 Flex to do this. No need for floating or clearing divs. Simply add Display: flex; to the parent container holding the items you wish to position.

    HTML

    <div id="textbox">
      <p class="alignleft">1/10</p>
      <p class="aligncenter">02:27</p>
      <p class="alignright">100%</p>
    </div>
    

    CSS

    #textbox {display:flex; flex-flow:row wrap;}
    
    .alignleft {
      width: 33.33333%;
      text-align: left;
    }
    .aligncenter {
      width: 33.33333%;
      text-align: center;
    }
    .alignright {
      width: 33.33333%;
      text-align: right;
    }
    

    Demo The Result Using Flex:
    http://jsfiddle.net/jcbiggar1/tsopnf4d/4/

    More on Flex:
    https://css-tricks.com/snippets/css/a-guide-to-flexbox/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to place the label text to left and the radio button to
I need to place two repeated background images on the left and right border
I need to draw a rectange,circle and line and then animate them(press left ->
I often need to list items with various-sized images on the left and text
I need three tables (div). The left and right sides of the occupied 50%
I need to bring .post_entry(right side) up so that it's level with .post_info(left side.
I need to align text using li in a centered table so that the
int maxSumRec(const vector<int> &a, int left, int right){ if (left == right){ if (a[left]
I have a View in my android app which I want to scale &
I need to get the left hand side integer value from a decimal or

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.