摘要:dfdf
因專案關係,需要中文直行排版,因此Google了一下解決方案
解決方案一
使用css的 layout-flow: vertical-ideographic
結果:
IE 系列顯示正常 | Firefox 無效 |
解決方案二
使用傳說中的HTML 5 ,不過等IE 9瀏覽器搓好湯圓在上市還有的等,
搞不好IE 9與其他家的搓法還不一樣。
DIY方案
遠水救不了近火,因此自已寫了個jQuery plugin,用法很簡單,使用方法請收看:
//words為每行限制的字數,預設每行為20字。 預設 css 名稱為 straight
$(document).ready(function() {
$("#test").straight({words:6});
});
//css 設定
.straight {
font-size:18px;
width: 1.5em;
font-family:微軟正黑體;
line-height:1.2em;
}
如果你需要自定義 css 名稱,使用方法請收看:
$(document).ready(function() {
$("#test").straight({setClass:'ttt'});
});
下載範例檔: