2016-11-28 64 views
1

即使按鈕上的文字增加,我也希望按鈕大小的大小固定。即使文本增加,按鈕大小也應該固定

我現在使用的代碼:

.button { 
 
    border: none; 
 
    color: white; 
 
    padding: 10px 50px; 
 
    text-align: center; 
 
    text-decoration: none; 
 
    display: inline-block; 
 
    font-size: 16px; 
 
    margin: 1px 1px; 
 
    transition-duration: 2s; 
 
    cursor: pointer; 
 
} 
 
.button4 { 
 
    background-color: #428BCA; 
 
    color: white; 
 
    height: auto; 
 
    width: auto; 
 
} 
 
.button4:hover { 
 
    background-color: #C0C0C0; 
 
}
<button class="button button4">Simplfy! 
 
    <br>Bona PARTe @ PT</button>

+0

爲什麼如果你想要修復按鈕尺寸,你在做高度和寬度自動調整? – progrAmmar

+0

然後在px中寫入寬度和高度。但是如果你能夠實現你的目標,甚至你希望textcan的尺寸更大,那麼你如何才能實現你的目標。所以你可以用更少的文本實現兩個或更多的文本或修復大小中的一個,當做上面的時候 – mean

回答

0

你需要指定一個固定的寬度和高度按鈕height: 100px; width: 100px;汽車將無法正常工作。自動選項將適應任何對象按鈕是英寸

+0

,當我添加更多文本時文本消散 –

+0

然後增加按鈕'height:100px;寬度:200px;' –

1

附加寬度,高度,以您的按鈕,如果你想查看溢出文字寫overflow: auto

.button4 { 
    width: 200px; 
    height: 100px; 
    overflow: auto; 
} 

這裏是fiddle

相關問題