Sure, here is how you can hide the horizontal scrollbar in HTML but not the vertical scrollbar:
HTML
<style>
/* Hide horizontal scrollbar */
.container {
overflow-x: hidden;
}
/* Keep vertical scrollbar visible */
.container {
overflow-y: visible;
}
</style>
<div class="container">
<h1>This is a heading</h1>
<p>This is a paragraph</p>
<p>This is another paragraph</p>
</div>
The overflow-x: hidden CSS property tells the browser to hide the horizontal scrollbar for the element with the class
container. The overflow-y: visible CSS property tells the browser to keep the vertical scrollbar visible for the element with the class
container.
This will hide the horizontal scrollbar for the container element, but will keep the vertical scrollbar visible.
Here is an example of how this would look in the browser:
This is a heading
This is a paragraph
This is another paragraph
The horizontal scrollbar is hidden, but the vertical scrollbar is still visible.
Markdown for AI
A clean, structured version of this page for AI assistants and LLMs.
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Policy.
Sure, here is how you can hide the horizontal scrollbar in HTML but not the vertical scrollbar:
HTML
The
overflow-x: hiddenCSS property tells the browser to hide the horizontal scrollbar for the element with the classcontainer. Theoverflow-y: visibleCSS property tells the browser to keep the vertical scrollbar visible for the element with the classcontainer.This will hide the horizontal scrollbar for the container element, but will keep the vertical scrollbar visible.
Here is an example of how this would look in the browser:
The horizontal scrollbar is hidden, but the vertical scrollbar is still visible.