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

229
Views
Always show horizontal scroll for div

Here's the basic template I have right now for my code (ReactJS), stripped down to what's required for my question. Here's a Code Sandbox.

<div style={{maxHeight: "500px", overflowY: "auto"}}>
  <pre>
    <code>
     //bunch of code to display on UI
    </code>
  </pre>
</div>

At any position other that at the bottom, the horizontal scroll bar is not there:

enter image description here

The horizontal scroll bar only shows when I scroll down to the bottom of the div:

enter image description here

How do I get a successfully working horizontal scroll bar to always show on the div, without having to scroll all the way down (and also remove the scroll bar that currently exists when I scroll down to the bottom)?

Edit: Figured it out:

.App pre {
  overflow-x: visible !important;
}
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

change overflowY: "auto" to overflowY:"scroll"

about 4 years ago · Juan Pablo Isaza Report

0

I figured out how to do it myself. Adding this fixed the problem. Check Code Sandbox.

.App pre {
  overflow-x: visible !important;
}
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!