How to make a DIV not wrap?

前端 未结 13 483
名媛妹妹
名媛妹妹 2020-11-30 19:32

I need to create a container DIV style that contains multiple other DIV\'s. It is asked that these DIV\'s wouldn\'t wrap if the browser window is resized to be narrow.

相关标签:
13条回答
  • 2020-11-30 20:12

    you can use

    display: table;
    

    for your container and therfore avoid the overflow: hidden;. It should do the job if you used it just for warpping purpose.

    0 讨论(0)
  • 2020-11-30 20:14

    The <span> tag is used to group inline-elements in a document.
    (source)

    0 讨论(0)
  • 2020-11-30 20:15

    Try to use width: 3000px; for the case of IE.

    0 讨论(0)
  • 2020-11-30 20:17
    <div style="height:200px;width:200px;border:; white-space: nowrap;overflow-x: scroll;overflow-y: hidden;">
       <p>The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.The quick brown fox jumps over the lazy dog.The quick brown fox jumps over the lazy dog.
       The quick brown fox jumps over the lazy dog.The quick brown fox jumps over the lazy dog.The quick brown fox jumps over the lazy dog.The quick brown fox jumps over the lazy dog.
       The quick brown fox jumps over the lazy dog.
       The quick brown fox jumps over the lazy dog.The quick brown fox jumps over the lazy dog.The quick brown fox jumps over the lazy dog.The quick brown fox jumps over the lazy dog.
       The quick brown fox jumps over the lazy dog.The quick brown fox jumps over the lazy dog.</p>
    </div>
    
    0 讨论(0)
  • 2020-11-30 20:18

    overflow: hidden should give you the correct behavior. My guess is that RTL is messed up because you have float: left on the encapsulated divs.

    Beside that bug, you got the right behavior.

    0 讨论(0)
  • 2020-11-30 20:19

    Try using white-space: nowrap; in the container style (instead of overflow: hidden;)

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