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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T00:44:13+00:00 2026-06-06T00:44:13+00:00

I have following code <div id=main> <div id=one> </div> <div id=two> </div> <div id=three>

  • 0

I have following code

<div id="main">
    <div id="one"> </div>
    <div id="two"> </div>
    <div id="three"> </div>
    <div id="four"> </div>
</div>

I need to align the middle 4 div as below, keeping equal space at each side (top-space = bottom-space and right-space = left-space):

______________________________________
|                                    |
|         ________  ________         |
|        |        ||        |        |
|        |  one   ||   two  |        |
|        |        ||        |        |
|        |________||________|        |
|         ________  ________         |
|        |        ||        |        |
|        | three  ||  four  |        |
|        |        ||        |        |
|        |________||________|        |
|                                    |
|____________________________________|

Four div’s equally spaced, please can anyone me help me out here with any css snippet? Also I do see a lot of question over this, but can’t get this fixed. Can someone point me to any useful link that explains all the concepts related to the div alignment perfectly ?

(Folks, I know this would be a duplicate, but please help as I am just going round and round by googling.)

Thanks in advance 🙂

  • 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-06T00:44:16+00:00Added an answer on June 6, 2026 at 12:44 am

    Here’s one way that works in all modern browsers, including IE8: jsFiddle example.

    HTML

    <div id="main">
        <div id="one"></div>
        <div id="two"></div><br />
        <div id="three"></div>
        <div id="four"></div>
    </div>​
    

    CSS

    div {
        border:1px solid #999;
    }
    #main {
        width:400px;
        height:400px;
        display:table-cell;
        vertical-align:middle;
        text-align:center;
    }
    #one,#two,#three,#four{
        width:100px;
        height:100px;   
        display:inline-block;    
    }
    

    ​
    Note that i did have to add one break tag (<br />) to your code.

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

Sidebar

Related Questions

I have the following HTML code: <div onclick=window.open('http://example.com') > <p>1234 Main St, New York,
I have the following HTML code <html> <body> <div id=wrapper> <div id=header/> <div id=main/>
I have the following code in my main index.php: <div class=form> <?php $oForm =
I have the following code: <a href=main.html class=admin><div class=buttonlabel>Admin</div></a> and CSS a.admin { display:block;
i have following code to show div on page <div id=all_users> <div id=user11 userid=11
I have following code in the html file: <div class=navbar navbar-fixed-top> <div class=navbar-inner> <div
I have following PHP code $val=<div id=user.$row['cid']. userid=.$row['cid']. class=innertxt><img src=images/images.jpg width=50 height=50><strong>.$uname.</strong><ul> <li>Email: .$row['cemail'].</li>
I have the following code: HTML <div id=addQuesion> <li> <label>Text</label> <input type=text/> </li> <li>
I have the following code: HTML : <div id='example'> <a href='#' data-name='foo' class='example-link'>Click Me</a>
I have the following code: <div style=width:560px> <div style=float: left; width: 50%; margin-bottom: 20px>

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.