了解mui css框架

 

加起來是12就對了

offset是靠左右的距離,左邊offset-1可以判斷右邊點是1,因此 10 + 1 + 1 =12

 

xs32代表320宽度

bar mui-col-xs32-12

 

64代表640

@media screen and (min-width: 640px)

mui-col-xs64-10

mui-col-xs64-offset-1(左右距离1)

 

max-width 以下

min-width 以上

CSS sprites 背景圖自適應

做RWD網站,發現用Css sprites的圖片沒辦法自適應,調background-size也不行(因為它會整張縮放)常常之後又改成img,實在太麻煩了!

後來我看這篇,終於實作出來了,感恩師父,讚嘆師父!

一般背景圖片要響應式,設寬度100%,再用高除以寬,得出來的值做成padding-top。(不設height)

首先要算出background-size再去算background-position

y就是同上面的逻辑去推算

xpos位置/(canvas寬度-icon圖片寬度)

173px / (1000px – 80px) = 0.1880434783 ->> 18.80434783%

1000px is the width of the background image (sprite)

80px is the width of displayed image

173px is the absolute x-coordinate of the displayed image.

 

【參考連結】

responsive sprites / percentages

記得看ChillyPenguin寫的,她的才正確