JavaDeveloper
JavaDeveloper

Reputation: 5660

How to place 2 text boxes in div, next to each other in React without using flex?

I have a div with 2 text boxes.

<div>
   <input ... />
   <input ... />
</div>

Issue is they get displayed below each other.

NOTE: I am not using React-Native, not using Flex.

How can I place them next to each other ?

Upvotes: 2

Views: 1823

Answers (1)

iHowell
iHowell

Reputation: 2447

Answer 1: Use Flexbox (or grid which is even more powerfull). Both of these are very powerful and wonderfully adaptive to the screen.

Answer 2: Use the hack that was used to do this before, using float. Give each of the input elements a style of float: left and add one div after with a css styling of clear: all, which will make it so the parent div has the correct height.

Upvotes: 3

Related Questions