To hide the horizontal scrollbar in CSS, you can use the overflow-x
property and set its value to hidden
. This will prevent the horizontal scrollbar from appearing, even if the content overflows the container's width.
Here's how you can do it:
.element {
overflow-x: hidden;
}
Replace .element
with the appropriate selector for the container or element where you want to hide the horizontal scrollbar.
Note: Use this property with caution. Hiding the horizontal scrollbar can make some content inaccessible if it overflows the container's boundaries. Always ensure that your design remains user-friendly and that all content is accessible.