HTML: How to create a DIV with only vertical scroll-bars for long paragraphs?

前端 未结 10 702
一向
一向 2020-12-07 16:32

I want to show terms and condition note on my website. I dont want to use text field and also dont want to use my whole page. I just want to display my text in selected area

相关标签:
10条回答
  • 2020-12-07 16:51

    You need to specify the width and height in px:

    width: 10px; height: 10px;
    

    In addition, you can use overflow: auto; to prevent the horizontal scrollbar from showing.

    Therefore, you may want to try the following:

    <div style="width:100px; height:100px; overflow: auto;" >
      text text text text text text text text text
      text text text text text text text text text
      text text text text text text text text text
      text text text text text text text text text
      text text text text text text text text text
      text text text text text text text text text
      text text text text text text text text text
      text text text text text text text text text
    </div>
    
    0 讨论(0)
  • 2020-12-07 16:51

    This is my mix:

    overflow-y: scroll;
    height: 13em; // Initial height.
    resize: vertical; // Allow user to change the vertical size.
    max-height: 31em; // If you want to constrain the max size.
    
    0 讨论(0)
  • 2020-12-07 16:52

    You can use the overflow property

    style="overflow: scroll ;max-height: 250px; width: 50%;"
    
    0 讨论(0)
  • 2020-12-07 16:58

    Use overflow-y. This property is CSS 3.

    0 讨论(0)
提交回复
热议问题