標題:手機版 nav line-height 與 padding 間的問題 出處:A.PAO designSTUDIO BLOG 時間:Thu, 04 Jan 2018 12:33:10 +0000 作者:apao 地址:https://blog.apao.idv.tw/post/1256/ 內容: 當我製作手機版網頁時,習慣性的沿用PC版的CSS定義 發現一個跟 padding 完全無關的問題(BUG) 點擊在新視窗中瀏覽此圖片 https://blog.apao.idv.tw/attachment.php?fid=2903 HTML for mobile 首頁 home商品清單 Category某某商品名稱 CSS for mobile nav{ width: 100%; background: url(../i/iconHomeGray-19.png) no-repeat left center; margin: 0 20px 0px 0; padding: 0 0 0 25px; color: rgba(0,0,0,1.00); font-size: 120%; line-height: 200%; /*記得不能加上行高*/ } nav a{ display: inline-block; background: rgba(101,109,168,0.70); margin: 0 5px 0 0; padding: 2px 4px; /*完全不為所動*/ border-radius: 9px; color: rgba(255,255,255,0.90); line-height: 200%; /*設定這裡的行高也會有問題*/ } nav span{ display: inline-block; } 點擊在新視窗中瀏覽此圖片 https://blog.apao.idv.tw/attachment.php?fid=2904 正常的 CSS for mobile nav{ width: 100%; background: url(../i/iconHomeGray-19.png) no-repeat left center; margin: 0 20px 0px 0; padding: 0 0 0 25px; color: rgba(0,0,0,1.00); font-size: 120%; /* line-height: 200%; 去除行高*/ } nav a{ display: inline-block; background: rgba(101,109,168,0.70); margin: 0 5px 0 0; padding: 2px 6px; /*改變這個部分*/ border-radius: 9px; color: rgba(255,255,255,0.90); /* line-height: 200%; 去除行高*/ } nav span{ display: inline-block; } Generated by Bo-blog 2.1.1 Release