幅は固定ですが高さは可変のHTMLテキストエリアがあります。overflow:scroll
垂直スクロールバーを設定して表示できるようにしたいが、水平スクロールバーは表示したくない。overflow:auto
他の事情により使用できません。
CSS2を使用して、垂直スクロールバーのみを表示し、水平スクロールバーは表示しない方法はないことを知っています。水平スクロールバーを非表示にするためにJavaScriptでできることはありますか?
幅は固定ですが高さは可変のHTMLテキストエリアがあります。overflow:scroll
垂直スクロールバーを設定して表示できるようにしたいが、水平スクロールバーは表示したくない。overflow:auto
他の事情により使用できません。
CSS2を使用して、垂直スクロールバーのみを表示し、水平スクロールバーは表示しない方法はないことを知っています。水平スクロールバーを非表示にするためにJavaScriptでできることはありますか?
回答:
次のようにcssを使用できます。
overflow-y: scroll;
overflow-x: hidden;
wrap=virtual
HTMLフォームボックスで使用すると、ボックスの下部にある水平スクロールバーが削除されます。
<textarea name= "enquiry" rows="4" cols="30" wrap="virtual"></textarea>
ここの例を参照してください:http : //jsbin.com/opube3/2 (FFおよびIEでテスト済み)
selector{
overflow-y: scroll;
overflow-x: hidden;
}
スニペットと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>
overflow:scroll;
ます。一方のバーを表示し、もう一方のバーを表示する方法はありません。それはに固有のものoverflow:scroll
です。JavaScriptは、CSSが許可するもののみを実行できます。しかし、私の推測では、overflow:autoを使用できると思います。「あなたの状況に固有のその他のこと」について詳しく教えてください。