WordPress更换字体-额外CSS
WordPress – 外观 – 自定义 – 额外CSS
更换鸿蒙字体
//HarmonyOS Sans字体加载
@font-face {
font-family:HarmonyOS_Sans_SC_Medium;font-style: normal;font-display: swap;
src: url('https://vkceyugu.cdn.bspapp.com/VKCEYUGU-52cc7ff7-fc64-49e7-b0a0-1dc090ee49a2/58d1ca58-60f0-454e-9f63-f802732a7078.woff2') format('woff2')
}
*{font-family:HarmonyOS_Sans_SC_Medium;}
css中引入方式:@import url(‘https://s1.hdslb.com/bfs/static/jinkela/long/font/regular.css’);
更换微软雅黑字体
*:not([class*="icon"]):not(i) {
font-family: Segoe UI, "Microsoft Yahei" !important;
}
上面的例子就是将字体全局优先替换成 Segio UI,其次替换成微软雅黑,下面列举几个比较适合阅读的字体,供大家替换,替换代码中的 Segio UI 和 Microsoft YaHei 即可。
宋体(SimSun),微软雅黑(”Microsoft Yahei”),华文黑体(STHeiti),冬青黑体( Hiragino Sans GB ),苹方(PingFang SC),Arial,Times New Roman,Droid Sans
附赠一个范例:
body {
font-family: Helvetica, 'PingFang TC', "微軟正黑體", "Microsoft JhengHei", sans-serif !important;
}
h1,h2,h3,h4,h5,h6{
font-family: Helvetica, 'PingFang TC', "微軟正黑體", "Microsoft JhengHei", sans-serif !important;
}
CSS来修改WordPress字体大小
修改文章内页字体大小,比如默认是12,适合英文,但是不适合中文
p {
font-size:18px;
}
如果我想修改H2标题呢?
h2 {
font-size:36px;
}
修改wocommerce产品描述的具体样式
.woocommerce-product-details__short-description,
.woocommerce-product-details__short-description p {
font-family: "微软雅黑", Arial, sans-serif;
font-size: 16px;
line-height: 1.5;
color: #333;
}
.woocommerce-product-details__short-description,
.woocommerce-product-details__short-description p {
font-family: "微软雅黑", Arial, sans-serif !important;
font-size: 16px !important;
line-height: 1.5 !important;
color: #333 !important;
}
