Have block level element fill 100% width of overflow-x: scroll container

后端 未结 4 1987
时光取名叫无心
时光取名叫无心 2021-01-18 05:58

I\'ve got a container element that\'s a certain width, with overflow-x: auto. In it I have a block level header element (h1) that\'s supposed to, being a block

4条回答
  •  日久生厌
    2021-01-18 06:56

    See the fiddle.

    Use the HTML caption element:

    header

    text text text text text text

    CSS:

    #one {
        width: 200px;
        overflow: auto;
        border: solid 1px;    
    }
    
    #one h1 {
        font-size 1.1em;
        background-color: blue;        
        margin-top: 0;
        text-align: left;
    }
    
    table td {
        border: solid 1px;
        padding: 20px;
    }
    

提交回复
热议问题