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

  • SEARCH
  • Home
  • 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 8751201
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T13:00:05+00:00 2026-06-13T13:00:05+00:00

On my page I have two elements in a header area. I would like

  • 0

On my page I have two elements in a header area. I would like the first element to be centered in the middle of the header area and a second element that is pushed all the way to the right side of the header area. I achieved the desired effect using this code:

<div id="header-area" style="text-align:center;width:100%;">
  <div id="partition1" style="display:inline-block;width:33%;"></div>
  <div id="partition2" style="display:inline-block;width:33%;">
    <div id="element1" style="display:inline;width:400px;height:100px;">
      <h3 style="display:inline;width:400px;">Main title Goes Here</h3><br/><br/>
      <p style="display:inline;width:400px;">Subtitle goes here</p>
    </div>
  </div>
  <div id="partition3" style="display:inline-block;width:33%;text-align:right;">
    <div id="Element2" style="display:inline;width:150px;vertical-align:middle;">
      <button onclick="history.back();" style="height:45px;width:100px;">
      Back</button>
    </div>
  </div>
</div>

You will notice I partitioned the header-area into three spaces and aligned the element1 & element2 within their respective partitions. How can I achieve the same layout without partitioning the header-area?

  • 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-13T13:00:07+00:00Added an answer on June 13, 2026 at 1:00 pm

    There’s several ways to do this. Here are two:

    Option #1: Float

    The HTML:

    <div id="header">
        <div class="right">Element on right end</div>
        <div class="center">Center-Aligned Element</div>
    </div>
    

    The CSS:

    #header {
        text-align: center;
    }
    
    #header div.center {
        margin: 0 auto;
        text-align: center;
        width: 30%;
    }
    
    #header div.right {
        float: right;
        text-align: right;
    }
    

    Option #2: Position absolute

    The HTML:

    <div id="header">
        <div>Center-Aligned Element</div>
        <div class="right">Element on right end</div>
    </div>
    

    The CSS:

    #header {
        text-align: center;
    }
    
    #header div {
        text-align: center;
        width: 30%;
        margin: 0 auto;
    }
    
    #header div.right {
        position: absolute;
        top: 0;
        right: 0;
        text-align: right;
    }
    

    Example Using Your Elements:

    The HTML:

    <div id="header">
        <h3>Main Title Goes Here</h3>
        <p>Subtitle Goes Here</h3>
        <button>Element on right end</button>
    </div>
    

    The CSS:

    #header {
        text-align: center;
    }
    
    #header h3,
    #header p {
        margin: 0 auto;
        text-align: center;
        width: 30%;
    }
    
    #header button {
        position: absolute;
        top: 0;
        right: 0;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two elements (a field and some text) that I would like to
I have two range sliders in my page, and I would like to implement
I have two form elements on my page that act as a smooth login
I would like to have two .css files. One for each master\content page and
We have a page that ordinarily has two elements arranged side-by-side. Despite exploring a
I have a very basic page with two elements, an outer green box, and
I have simple page using a two-column page layout that breaks on zooming. Here
I have got an issue in a header where I want the middle element
I have a header that should always be displayed on top of the page
I have an application that has an included header file in each page. The

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.