creating two div right next to each other on css? [duplicate]
i wanted to know how to put two div right next each other centered in the page like this:
divLeft | div right
|
|
|
|
thank you :))
.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.
Using float:left;
and display:inline;
, also you might want to set the width, using width:200px;
.
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.
精彩评论