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 9310577
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T01:09:00+00:00 2026-06-19T01:09:00+00:00

Consider a simple webpage like this one: <!DOCTYPE html> <html><head><title>Test!</title></head> <body> <p>a b c</p>

  • 0

Consider a simple webpage like this one:

<!DOCTYPE html>
<html><head><title>Test!</title></head>
<body>
<p>a b c</p>
</body></html>

I’d like to have the a b c formatted as if I wrote a\hfill b\hfill c in TeX. This is: a on the left, then b centered, then c on right; all on the same line. How can I do this?

  • 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-19T01:09:02+00:00Added an answer on June 19, 2026 at 1:09 am

    How you would go about this greatly depends on how you want the spacing to be when there’s actually content here. These techniques will work with any tags, I chose a list here for simplicity. If you’re using p and span, then replace ul with p and li with span.

    <ul>
        <li>a</li>
        <li>b</li>
        <li>c</li>
    </ul>
    

    All 3 of these techniques work without modifying the source order. Floats could do the job, but you would have to place c before b for it to work properly.


    This technique uses flexbox and assumes that the elements containing a, b, and c are just large enough to contain them and the space between them is equal (if a is larger than b, then b will not be centered). Flexbox has a lot of options to determine behavior regarding wrapping, but the default is to not wrap at all.

    http://jsfiddle.net/4g8NY/1/ (prefixes not included)

    ul {
        display: flex;
        justify-content: space-between;
    }
    

    Flexbox does not have very widespread support at the moment, due to the fact that IE10 is the first IE version to support it. http://caniuse.com/#search=flexbox


    You could use the display: table family along with text-alignment to give the illusion that the elements are distributed in the desired way, but their containers take up 33% of their parent’s width. In this example, b should remain perfectly centered regardless of the actual content. Your elements are also equal height and will be forced to appear on the same line no matter what.

    Unlike the other techniques, this assumes there will only ever be 3 elements. You’ll need to modify the column widths and tinker with which columns should have which alignment each time you add an element.

    http://jsfiddle.net/4g8NY/2/

    ul {
        display: table;
        width: 100%;
    }
    
    li {
        display: table-cell;
        width: 33%;
    }
    
    li:nth-child(2) {
        text-align: center;
    }
    
    li:last-child {
        text-align: right;
    }
    

    Support for this technique is very good, since all of our properties are available in IE8 (IE8 is my official cutoff, IE7 and older are not considered “supported browsers”).


    The third technique involves using a pseudo element as the last line of the parent element so that we can justify a, b, and c. There is no way to prevent wrapping with this technique if the elements do not fit on the same line.

    Unlike the other techniques, additional markup is not necessary. It could just be a p tag like you already have in your example code.

    http://jsfiddle.net/4g8NY/3/

    ul {
        text-align: justify;
    }
    
    ul:after {
        content: " ";
        display: inline-block;
        width: 100%;
    }
    
    li {
        display: inline; /* if you're using an element that's already `inline` like a span, you don't need this */
    }
    

    Similar to the above technique, it works in IE8 or better.

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

Sidebar

Related Questions

Consider a document in the following format: <!DOCTYPE html> <html> <head> <title></title> <body> <div
Consider this simple markup: <body> <div style=border: 2px solid navy; position:absolute; width:100%; height:100%> </div>
Consider simple XML document: <html><body> <table> <tr><td> Item 1</td></tr> <tr><td> Item 2</td></tr> </table> </body></html>
please consider this scenario: we have two web page. a simple page that contains
Consider this simple class: package net.zomis.test; public class Test { public Test() { }
Consider this simple model, where a Project has one ProjectType and, naturally many Projects
Consider a simple Enumerator like this: natural_numbers = Enumerator.new do |yielder| number = 1
Consider a simple table with an auto-increment column like this: CREATE TABLE foo (
Consider a simple JS event of document.getElementsByClassName('test')[0].onclick=function(){ document.getElementsByClassName('test')[0].innerHTML = 'New Text'; } How can
Consider this simple model: A base Location table: +-------------------------------+ | Locations | +-------------------------------+ |(PK)

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.