button的line-height影響對(duì)齊的問(wèn)題,誰(shuí)能給解釋一下?
#btn1{
height: 15px;
line-height: 0;
}
#btn2{
height: 15px;
line-height: normal;
}
#btn1{
height: 25px;
line-height: 0;
}
#btn2{
height: 25px;
line-height: normal;
}
#btn1{
height: 15px;
line-height: 0;
}
#btn2{
height: 15px;
line-height: normal;
}
#btn1{
height: 25px;
line-height: 0;
}
#btn2{
height: 25px;
line-height: normal;
}
2016-02-21
舉報(bào)
2017-08-08
line-height:normal是瀏覽器自動(dòng)計(jì)算的合適的行高,一般為font-size的1.14倍,而且每個(gè)瀏覽器解析的不太一樣。你的代碼中沒(méi)寫(xiě)字體大小,那默認(rèn)就是16px,那么行高為19px左右。第一個(gè)例子中你給的高度是15px,小于行高,我的理解是行高將button頂上去了。設(shè)置行高為0的button就不會(huì)受影響了。第二個(gè)例子中行高給了25px,比行高要高了,所以兩個(gè)button近似對(duì)齊。行高并不會(huì)影響button的高度,沒(méi)有文字的話兩個(gè)button都是對(duì)齊的