J'ai un HTML textarea qui est de largeur fixe, mais de hauteur variable. J'aimerais définir overflow:scroll
et pouvoir afficher une barre de défilement verticale, mais pas horizontale. Je ne peux pas utiliser overflow:auto
à cause d'autres choses spécifiques à ma situation.
Je sais qu'il est impossible d'utiliser CSS2 pour afficher uniquement des barres de défilement verticales, mais non horizontales. Y a-t-il quelque chose que je puisse faire avec JavaScript pour masquer la barre de défilement horizontale?
Vous pouvez utiliser css comme ceci:
overflow-y: scroll;
overflow-x: hidden;
Utilisez CSS. C'est plus facile et plus rapide que javascript.
overflow-x: hidden;
overflow-y: scroll;
Désactivez complètement la barre de défilement horizontale en ajoutant ce code.
body{
overflow-x: hidden;
overflow-y: scroll;
}
L'utilisation de wrap=virtual
dans vos zones de formulaire HTML supprime la barre de défilement horizontale au bas de la zone:
<textarea name= "enquiry" rows="4" cols="30" wrap="virtual"></textarea>
Voir exemple ici: http://jsbin.com/opube3/2 (Testé sur FF et IE)
selector{
overflow-y: scroll;
overflow-x: hidden;
}
Exemple de travail avec extrait et lien jsfiddle https://jsfiddle.net/sx8u82xp/3/
.container{
height:100vh;
overflow-y:scroll;
overflow-x: hidden;
background:yellow;
}
<div class="container">
<p>
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
Why do we use it?
It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).
</p>
<p>
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
Why do we use it?
It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).
</p>
<p>
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
Why do we use it?
It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).
</p>
<p>
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
Why do we use it?
It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).
</p>
</div>
<div style="width:100px;height:100px;overflow-x:hidden;overflow-y:auto;background-color:#000000">
.combobox_selector ul {
padding: 0;
margin: 0;
list-style: none;
border:1px solid #CCC;
height: 200px;
overflow: auto;
overflow-x: hidden;
}
définit une taille de défilement de 200 pixels, overflow-x
masque toutes les barres de défilement horizontales.
Pour moi:
.ui-jqgrid .ui-jqgrid-bdiv {
position: relative;
margin: 0;
padding: 0;
overflow-y: auto; <------
overflow-x: hidden; <-----
text-align: left;
}
Bien sûr enlever les flèches