A div, height is fixed, how to make the horizontal scroll bar appear when there is too much content inside?

that is, the content is on one line, but you can scroll left and right to see more text

Sep.16,2021

use white-space:nowrap to prohibit line wrapping


css add overflow-x: scroll


CSS to set overflow-x: scroll (horizontal scroll bar) and overflow-y: scroll (vertical scroll bar) for div.


two boxes are needed, the outside is fixed width and height, the inside of overflow:auto; is wider than the outside, or white-space:nowrap is fine.

<div style='width:200px;overflow:auto;'>
    <p style='white-space:nowrap'>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

</div>
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b379fc-410ec.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b379fc-410ec.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?