2014年8月25日 星期一

讓bootstrap的column等高的方法

http://stackoverflow.com/questions/19695784/how-can-i-make-bootstrap-columns-all-the-same-height

.row {
    overflow: hidden; 
}

[class*="col-"] {
    margin-bottom: -99999px; /* 讓overflow發生 */
    padding-bottom: 99999px; /* 讓padding-bottom超長,藉此拉長背景 */
}

如果不懂為何可以這樣的話,可以試著把overflow: hidden去掉,這樣也許就可以理解了

(當並排的區塊元素需要等高時,都可以用這招)

表單格式心得

網頁的form需要先用Javascript檢查格式後才送出
但後端的php仍然需要對欄位格式做檢查,不同的地方是當格式錯誤時,後端只要直接return就好了,不需要回傳錯誤訊息

2014年8月24日 星期日

CSS/Javascript Playgrounds

http://designshack.net/articles/css/5-online-playgrounds-for-html-css-and-javascript-compared/

CSS pixel & Device pixel

1.
At zoom level 100% one CSS pixel is exactly equal to one device pixel.

2.
Zooming as implemented in modern browsers consists of nothing more than “stretching up” pixels. That is, the width of the element is not changed from 128 to 256 pixels; instead the actual pixels are doubled in size. Formally, the element still has a width of 128 CSS pixels, even though it happens to take the space of 256 device pixels.

以上節錄自http://www.quirksmode.org/

對CSS, JS跨平台有完整探討的網站

http://www.quirksmode.org/

此外,http://www.quirksmode.org/mobile/裡面的The three viewports系列文章是鑽研CSS排版必讀的文章

2014年8月4日 星期一

session_set_cookie_params()

session_set_cookie_params()要在session_start()之前呼叫
session_set_cookie_params()是"當client沒有傳session key時,設定cookie為參數所指定的值"
換句話說,當使用者下一次瀏覽該頁面時,因為client會傳session key給server,所以session_set_cookie_params()並不會更新cookie lifetime
得用setcookie()更新cookie lifetime