Skip to content

Instantly share code, notes, and snippets.

@z1076
Last active August 6, 2021 02:35
Show Gist options
  • Save z1076/b96bc8bd49e9a28d4bc3c2f6150a55b7 to your computer and use it in GitHub Desktop.
Save z1076/b96bc8bd49e9a28d4bc3c2f6150a55b7 to your computer and use it in GitHub Desktop.
[Css 常用] #css
// vim: syntax=css
/* 兼容iphone5/SE */
@media (device-height:568px) and (-webkit-min-device-pixel-ratio:2){
.member-info-score{
float:right;width:70%;margin-top:.7rem;
}
}
/* 设置了浏览器宽度不小于1201px时 abc 显示1200px宽度 */
@media screen and (max-width: 1200px) {
.abc {
width: 900px
}
}
/* 设置了浏览器宽度不大于1200px时 abc 显示900px宽度 */
@media screen and (max-width: 901px) {
.abc {
width: 200px;
}
}
/* H5样式 */
body{font-family:Arial;font-size:16px;margin:0 auto;padding:0;background:#f3f3f3;min-width:320px;max-width:640px;color:#333;text-align:justify;word-wrap:break-word;-webkit-text-size-adjust:none;-webkit-tap-highlight-color:rgba(0,0,0,0.1)}
div{margin:0 auto;padding:0}
var screenHeight = document.documentElement.clientHeight,
screenWidth = window.screen.availWidth || document.documentElement.clientWidth,
sWidth = screenWidth > 414 ? (screenWidth / window.devicePixelRatio) : screenWidth,
fontSize = (sWidth > 414 ? 414 : sWidth) / 750 * 100;
document.documentElement.style.fontSize = fontSize + "px";
/*
简单实现夜间模式
参考: https://kevq.uk/how-to-add-css-dark-mode-to-a-website/. 具体实现为生命css变量, 分白天和夜间两种.
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment