2

Below is just a snippet of my code:

return(
     <div className='row'>
         <div>row1</div><div>row2</div><div>row3</div>
     </div>
);

I tried this, but it displays in vertical. Image attached below

enter image description here

Kangkan
  • 127
  • 1
  • 2
  • 10

2 Answers2

6

It is not Reactjs problem. use CSS to do that. display:inline

 display: flex

div{
    display: flex;
}
<div className='row'>
     <div>row1</div><div>row2</div><div>row3</div>
</div>

OR use display:inline

div{
    display: inline
}
<div className='row'>
    <div>row1</div><div>row2</div><div>row3</div>
</div>
Olcay Ertaş
  • 5,987
  • 8
  • 76
  • 112
Dinesh undefined
  • 5,490
  • 2
  • 19
  • 40
6

Nothing to do with React, but CSS :

 <div className='rows'>
     <div className='row'>row1</div>
     <div className='row'>row2</div>
     <div className='row'>row3</div>
 </div>

One way to do it, in your CSS :

 .rows .row {
    display: inline-block;
 }
Alexis Facques
  • 1,783
  • 11
  • 19