Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

127
Views
Creating a side by side div and responsive top bottom div in reactjs

I am using ReactJs to learn to build a site

<div>
      <div className = "Home">
         <div className = "wrapper">
                <div className= "one" > 
                  <img src={image} alt="clock" height = '590px' width='590px'></img>
                 </div>
                <div className="two"> 
                <center>
                   <p>Perfect tool to get your </p>
                   <p> service on <mark className = 'ser'>Word</mark></p>
                   </center>
                   <div className = 'btn_see'>
                     <a href="/" class="button">Explore</a>
                   </div>
                 </div>
          </div>

this is the code on js page and here is css code for div:

.wrapper { 
    border : 2px solid #000; 
    overflow:hidden;
  }
  
  .wrapper div {
     min-height: 200px;
     padding: 10px;
  }
  .one {
   
    float:left; 
    margin-right:20px;
    width:50%;
    border-right:2px solid #000;
  }
  .two { 
    overflow:hidden;
    margin:10px;
    border:2px dashed #ccc;
    min-height:170px;
  }
  /*mobile*/
  @media screen and (max-width: 800px) {
     #one { 
      float: none;
      margin-right:0;
      width:auto;
      border:0;
    }
  }

while on desktop, it works as intended but on mobile, it should go one below the another which it does not instead it stacks on one another is something wrong with my code.

How it should and is looking on desktop side by side div

How it should look on mobile but isn't

top bottom div in responsive

is something wrong with my code, please help I am new.

about 4 years ago · Juan Pablo Isaza
3 answers
Answer question

0

There are different approaches to make this happen.

 1. Flex Box System
 2. Grid System

Hint: You can do it with flex box and when it turns into its mobile version, all of the blocks must be in a horizontal direction.

about 4 years ago · Juan Pablo Isaza Report

0

I'm not seeing any element with ID one in your html, so i'm assuming you want to select the class name, in which case your selector in the media query should be .one as you've written above and not #one. # is used to select IDs . is used to select classes.

about 4 years ago · Juan Pablo Isaza Report

0

You can use either Grid or Flex. They are both ways to make a layout responsive and with a lot of features that will make this task easy. Below is a snippet on how you could make it stack on mobile using flex. Also, here's some references on both grid and felxbox. Use whichever seems more fitting to your needs:

Grid: grid

Flexbox: Basic concepts of flexbox

#wrapper{
  display: flex;
  flex-direction: row;
}

#one {
  background-color: #808080;
}

#two {
  background-color: blue;
}
#wrapper div{
   min-height: 200px;
   padding: 10px;
}

@media screen and (max-width: 800px) {
     #wrapper { 
     flex-direction: column;
    }
}
<div id="wrapper">
  <div id="one">
    I'm the first
  </div>
  <div id="two">
    I'm the second
  </div>
</div>

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!