resize buttons responsively in bootstrap

后端 未结 3 1763
后悔当初
后悔当初 2020-12-10 01:12

I\'m using bootstrap, and the CSS is responsive, so it scales down nicely on smaller devices. However, I would like buttons to shrink too when the viewport is smaller (eg. o

3条回答
  •  心在旅途
    2020-12-10 01:51

    You could use CSS @media queries to scale the buttons accordingly..

    @media (max-width: 768px) {
      .btn-responsive {
        padding:2px 4px;
        font-size:80%;
        line-height: 1;
      }
    }
    
    @media (min-width: 769px) and (max-width: 992px) {
      .btn-responsive {
        padding:4px 9px;
        font-size:90%;
        line-height: 1.2;
      }
    }
    

    Demo: http://bootply.com/93706

    Update for Bootstrap 4:
    Bootstrap 4 responsive button size

提交回复
热议问题