-1

i tried to use marging left but still not working can any

<div style="width: 100%;">
    <div  height: 100px;  background: green;"> 
        Left Div 
    </div>
    <div style="margin-left: 50%; height: 100px; background: blue;"> 
        Right Div
    </div>
</div>

3 Answers3

0

you can just add to the first child float left and widht 50% and give both of them display inline-block

0

This is not an Angular problem. By default, div elements have the style attribute display: block which will place them on their own line/block.

div {
  height: 100px;
  width: 100px;
  border: 1px solid black;
}
<div>Div 1</div>
<div>Div 2</div>

If you want them to be side-by-side, you can change their style attribute to display: inline-block.

div {
  height: 100px;
  width: 100px;
  border: 1px solid black;
  display: inline-block;
}
<div>Div 1</div>
<div>Div 2</div>
D M
  • 5,769
  • 4
  • 12
  • 27
0

you can use flex

<div style="width: 100%; display:flex">
<div  height: 100px;  background: green; width:50%"> 
    Left Div 
</div>
<div style="margin-left: 50%; height: 100px; background: blue;width:50%"> 
    Right Div
</div>
sanaz
  • 176
  • 9