Top-align text within button element?

后端 未结 3 1005
野的像风
野的像风 2020-12-07 02:29

I have some buttons that have varying numbers of lines of text, all with a fixed width and height. It seems that anything I put between the

3条回答
  •  天涯浪人
    2020-12-07 02:36

    You just need to change the CSS of Button and Span. Separate both the CSS and make following changes:

    button {
        display: block;
        position: relative;
    }
    
    span {
        display: block;
        position: absolute; //<-- Make it absolute
        top: 0px;           //<-- Set the top property accordingly. In this case 0px;    
    }
    

    Set the position of span as absolute and set top property accordingly

提交回复
热议问题