css常用代码
透明度:
filter:alpha(opacity=50);
-moz-opacity:0.5;
opacity:0.5;
英文大小写:
div{text-transform:capitalize|Uppercase|Lowercase} Capitalize 英文拼音的首字母大写 Uppercase 英文拼音字母全大写 Lowercase 英文拼音字母全小写
文字超过部分显示省略号:
overflow:hidden;
text-overflow:ellipsis;
white-space:nowrap;
单词换行,文本换行word-wrap,word-break,white-space
http://jingyan.baidu.com/article/e75aca855b1500142edac6d0.html
优雅的多平台字体设置
font-family: "Helvetica Neue",Helvetica,Arial,"Microsoft Yahei","Hiragino Sans GB","Heiti SC","WenQuanYi Micro Hei",sans-serif;
判断iphoneX
/* iphoneX */
@media only screen and (min-width: 375px) and (min-height: 812px) and (-webkit-device-pixel-ratio: 3) {
body {
padding: 80px 0;
}
}
function isIphoneX(){
return /iphone/gi.test(navigator.userAgent) && (screen.height == 812 && screen.width == 375)
}