2

i wanted to know how to put two div right next each other centered in the page like this:

 divLeft                     |                     div right
                             |
                             |
                             |
                             |

thank you :))

getaway
  • 8,792
  • 22
  • 64
  • 94

3 Answers3

2
.float-left
{
  float: left;
}

.float-right
{
  float: right;
}

.wrapper
{
  width: 500px;
}

<div id="WrapperDiv" class="wrapper">
    <div id="RightDiv" class="float-right">Content for right div goes here</div>
    <div id="LeftDiv" class="float-left">Content for left div goes here</div>
</div>

You can adjust the width value in wrapper class to suit your needs.

Mahesh Velaga
  • 21,633
  • 5
  • 37
  • 59
0

Using float:left; and display:inline;, also you might want to set the width, using width:200px;.

Christian
  • 27,509
  • 17
  • 111
  • 155
0

Well, depending on how expandable it is you could do the following:

.rightDiv
{
    float: left;
    margin-left: 400px; /* Or whatever */
    width: 400px;
}
.leftDiv
{
    float: right;
    margin-right: 400px;
    width: 400px;
}

I haven't tested it but basically you want to float them the wrong way and then use the margin to push it back towards the center line.

Josh K
  • 28,364
  • 20
  • 86
  • 132