I want to write in the HTML how to place these boxes side by side
CodePudding user response:
Always include your code in the question so people can understand how you are doing things. Saying what you've tried also helps.
For this html:
<div >
<div >div1</div>
<div >div2</div>
</div>
You can use this css to place both divs side by side (the trick is on the display):
div.parent{
display: flex;
}
div.child{
width: 50%;
height: 100px;
background: yellow;
text-align: center;
box-sizing: border-box;
border: 1px solid red;
}
CodePudding user response:
You can add justify-content: space-between
to the container then wrap the two inputs in another div.
Or you can add margin-left: auto
on the first input and it'll push the 2nd input as well.