How to make Twitter Bootstrap's
 blocks scroll horizontally?

后端 未结 4 1333
谎友^
谎友^ 2021-01-30 10:29

Per the examples https://getbootstrap.com/docs/4.3/content/code/#code-blocks, bootstrap only supports vertically-scrollable and word-wrapped

 blocks out          


        
4条回答
  •  猫巷女王i
    2021-01-30 10:44

    I keep coming back to this answer when I start new projects and have to read through comments to remember, oh yea, don't override the bootstrap class and don't forget overflow-wrap, etc...

    So you have the stock pre-scrollable, which is vertical only scrolling, you may also want:

    Horizontal only scrolling

    .pre-x-scrollable {
        overflow: auto;
        -ms-word-wrap: normal;
        word-wrap: normal;
        overflow-wrap: normal;
        white-space: pre;
    }
    

    Vertical and Horizontal scrolling

    .pre-xy-scrollable {
        overflow: auto;
        -ms-word-wrap: normal;
        word-wrap: normal;
        overflow-wrap: normal;
        white-space: pre;
        max-height: 340px;
    }
    

提交回复
热议问题