# 重新设计的现代风格 CSS 现已正式发布（2023.10.20更新）

**URL:** <https://forum.freemdict.com/t/topic/16055>\
**Category:** 词典装饰排版交流分享\
**Tags:** css, 改版\
**Created:** [2022 年10 月 7 日 10:15 UTC](https://forum.freemdict.com/t/topic/16055 "2022-10-07T10:15:57Z")\
**Posts on this page:** 20\
**Page:** 7

<div class="post-metadata">

作者： ![startle](https://forumcdn.freemdict.com/user_avatar/forum.freemdict.com/startle/32/22231_2.png) [@startle](https://forum.freemdict.com/u/startle)\
发布日期： [2022 年10 月 31 日 03:50 UTC](https://forum.freemdict.com/t/topic/16055/125 "2022-10-31T03:50:28Z")

</div>

在使用可变字体的过程中，我也遇到了这些问题。  
把它分享出来，这样或许你们也可以少走一些弯路。

## 在 CSS 中启用可变字体

```css
@font-face{
    
    font-weight: 200 700;
    src: url("./Inter.ttf");
    font-style: normal;
}

html, body {
    font-family: "Inter", "SF Pro", sans-serif;
    font-weight: 600;
    font-variation-settings: "slnt"1, "opsz"17;  
    /* Inter 还不支持 slnt，这里只是举个例子说明
    	可变字体的可变属性应该怎么设置。 
    */
    
    font-optical-sizing: auto;
    font-feature-settings: "cv11" on, "ss07" on;
}

```

1. 其中，字重可以不必在 `font-weight-settings` 里面设置 `"wght"700`，直接使用 `font-weight: 700` 即可。

2. 在 `@font-face` 内部必须指明可变字体的字重范围 `font-weight: 100 1000`，否则浏览器不会以为这是可变字体，只会使用一种字重，对于更粗的字重，将使用浏览器自己的算法加粗字体（可以理解为 **机械地描边** ），使得显示出来的字体并不那么美观。毕竟字体设计需要经过专门的美学微调，简单粗暴的算法是无法完美地解决不同字重的问题的。

3. 光学尺寸：推荐在具体使用的过程中使用 `font-optical-sizing: auto` 属性，自动设置光学尺寸。

4. `font-feature-settings: "cv11" on, "ss07" on`

 ![image](https://forumcdn.freemdict.com/uploads/default/original/3X/d/b/db5dbaa6679bc0484ffc896debf4b703c596c1d2.png)

---

<div class="post-metadata">

作者： ![leebye](https://forumcdn.freemdict.com/letter_avatar_proxy/v4/letter/l/4bbf92/32.png) [@leebye](https://forum.freemdict.com/u/leebye)\
发布日期： [2022 年10 月 31 日 03:52 UTC](https://forum.freemdict.com/t/topic/16055/126 "2022-10-31T03:52:29Z")

</div>

1.6 这次灰块确实没了，完美解决，旗子居然也跳出来了，不知道昨晚是啥情况

 ![image](https://forumcdn.freemdict.com/uploads/default/original/3X/5/8/588915a84d41a782b46f9439e6b45971bfc13812.png)

不过手机版欧路还是没旗子，也没渐变，可能跟我的系统有关系吧，手机安卓版已更新最新的8.2.2(20251)，系统是安卓12

---

<div class="post-metadata">

作者： ![startle](https://forumcdn.freemdict.com/user_avatar/forum.freemdict.com/startle/32/22231_2.png) [@startle](https://forum.freemdict.com/u/startle)\
发布日期： [2022 年10 月 31 日 04:15 UTC](https://forum.freemdict.com/t/topic/16055/127 "2022-10-31T04:15:20Z")

</div>

好奇怪啊，我的手机也是 Android 12，但能够正常显示国旗。

 ![Screenshot_2022-10-31-12-13-07-601_com.eusoft.eudic](https://forumcdn.freemdict.com/uploads/default/original/3X/9/4/94803fbebd7d9103db3c5ea025c2b72503b4f98d.jpeg)

 ![Screenshot_2022-10-31-12-14-15-670_com.android.settings](https://forumcdn.freemdict.com/uploads/default/original/3X/8/b/8b4ebdaa22e371d05d89547f0e7536ee7666d2bd.jpeg)

---

<div class="post-metadata">

作者： ![维天有汉](https://forumcdn.freemdict.com/letter_avatar_proxy/v4/letter/%E7%BB%B4/51bf81/32.png) [@维天有汉](https://forum.freemdict.com/u/%E7%BB%B4%E5%A4%A9%E6%9C%89%E6%B1%89)\
发布日期： [2022 年10 月 31 日 06:04 UTC](https://forum.freemdict.com/t/topic/16055/128 "2022-10-31T06:04:08Z")

</div>

![图片](https://forumcdn.freemdict.com/uploads/default/original/3X/e/3/e31be5391748fc62117143e46e67ab51946786f5.jpeg)  
变这样了。1.5是正常的。

---

<div class="post-metadata">

作者： ![leebye](https://forumcdn.freemdict.com/letter_avatar_proxy/v4/letter/l/4bbf92/32.png) [@leebye](https://forum.freemdict.com/u/leebye)\
发布日期： [2022 年10 月 31 日 06:06 UTC](https://forum.freemdict.com/t/topic/16055/129 "2022-10-31T06:06:17Z")

</div>

那不知道为何了，我一直都没正常显示过旗子呢。我是MI10Pro，MIUI13稳定版

---

<div class="post-metadata">

作者： ![维天有汉](https://forumcdn.freemdict.com/letter_avatar_proxy/v4/letter/%E7%BB%B4/51bf81/32.png) [@维天有汉](https://forum.freemdict.com/u/%E7%BB%B4%E5%A4%A9%E6%9C%89%E6%B1%89)\
发布日期： [2022 年10 月 31 日 06:07 UTC](https://forum.freemdict.com/t/topic/16055/130 "2022-10-31T06:07:39Z")

</div>

ios的小鸟也不见了。

---

<div class="post-metadata">

作者： ![startle](https://forumcdn.freemdict.com/user_avatar/forum.freemdict.com/startle/32/22231_2.png) [@startle](https://forum.freemdict.com/u/startle)\
发布日期： [2022 年10 月 31 日 08:02 UTC](https://forum.freemdict.com/t/topic/16055/131 "2022-10-31T08:02:59Z")

</div>

可以对你的手机词典界面截个图么？  
我估计有可能是 JS 中的替换函数的执行时间不对，稍后还要再研究一下 JS 函数的执行时间。

---

<div class="post-metadata">

作者： ![leebye](https://forumcdn.freemdict.com/letter_avatar_proxy/v4/letter/l/4bbf92/32.png) [@leebye](https://forum.freemdict.com/u/leebye)\
发布日期： [2022 年10 月 31 日 08:13 UTC](https://forum.freemdict.com/t/topic/16055/132 "2022-10-31T08:13:19Z")

</div>

![Screenshot_2022-10-31-16-10-59-242_com.eusoft.eudic](https://forumcdn.freemdict.com/uploads/default/original/3X/5/c/5c0eaeda98eae1053b7ab535adafb81cba18c849.jpeg)  
可以，现在是都没有显示的，我直接下载的1.6覆盖以后清过缓存查询了两次，都没有旗子

---

<div class="post-metadata">

作者： ![startle](https://forumcdn.freemdict.com/user_avatar/forum.freemdict.com/startle/32/22231_2.png) [@startle](https://forum.freemdict.com/u/startle)\
发布日期： [2022 年10 月 31 日 09:14 UTC](https://forum.freemdict.com/t/topic/16055/133 "2022-10-31T09:14:09Z")

</div>

看你的截图，应该还是 JS 中的替换函数未被执行。  
看来欧路的兼容性也堪忧啊，明明浏览器一次都没出过问题。  
之后我会试试修改执行时机，或者直接向欧路词典报告问题。  
你试试 App Store 的 MDict AD 软件能不能正常显示呢？

 ![图片](https://forumcdn.freemdict.com/uploads/default/original/3X/7/0/70e8502f545a52706d79e4958d7a3151bc2e4377.jpeg)

---

<div class="post-metadata">

作者： ![独行瞏瞏](https://forumcdn.freemdict.com/user_avatar/forum.freemdict.com/%E7%8B%AC%E8%A1%8C%E7%9E%8F%E7%9E%8F/32/6802_2.png) [@独行瞏瞏](https://forum.freemdict.com/u/%E7%8B%AC%E8%A1%8C%E7%9E%8F%E7%9E%8F)\
发布日期： [2022 年10 月 31 日 09:27 UTC](https://forum.freemdict.com/t/topic/16055/134 "2022-10-31T09:27:11Z")

</div>

报告个小问题，移动端欧路词典黑暗模式无法显示。

---

<div class="post-metadata">

作者： ![startle](https://forumcdn.freemdict.com/user_avatar/forum.freemdict.com/startle/32/22231_2.png) [@startle](https://forum.freemdict.com/u/startle)\
发布日期： [2022 年10 月 31 日 09:29 UTC](https://forum.freemdict.com/t/topic/16055/135 "2022-10-31T09:29:46Z")

</div>

😂 因为我暂未考虑适配暗黑模式。  
可能得等到 1 月才会有时间考虑适配。

---

<div class="post-metadata">

作者： ![hahaya](https://forumcdn.freemdict.com/letter_avatar_proxy/v4/letter/h/77aa72/32.png) [@hahaya](https://forum.freemdict.com/u/hahaya)\
发布日期： [2022 年10 月 31 日 09:34 UTC](https://forum.freemdict.com/t/topic/16055/136 "2022-10-31T09:34:47Z")

</div>

用上新css和js后，有些地方没有左对齐：

 ![image](https://forumcdn.freemdict.com/uploads/default/original/3X/9/8/98a4510fe993d4b5539cb74c58e2f062666807fe.png)

---

<div class="post-metadata">

作者： ![维天有汉](https://forumcdn.freemdict.com/letter_avatar_proxy/v4/letter/%E7%BB%B4/51bf81/32.png) [@维天有汉](https://forum.freemdict.com/u/%E7%BB%B4%E5%A4%A9%E6%9C%89%E6%B1%89)\
发布日期： [2022 年10 月 31 日 10:13 UTC](https://forum.freemdict.com/t/topic/16055/137 "2022-10-31T10:13:54Z")

</div>

mdict可以正常显示。

---

<div class="post-metadata">

作者： ![startle](https://forumcdn.freemdict.com/user_avatar/forum.freemdict.com/startle/32/22231_2.png) [@startle](https://forum.freemdict.com/u/startle)\
发布日期： [2022 年10 月 31 日 12:09 UTC](https://forum.freemdict.com/t/topic/16055/138 "2022-10-31T12:09:34Z")

</div>

这次给欧路词典反馈的 bug，我甚至都做成了 PDF 🤣

> **[iCloud.com](https://www.icloud.com.cn/iclouddrive/0b6h5vr4A1YA9xuhhSaKpvEmg)**
>
> Sign in to iCloud to access your photos, videos, documents, notes, contacts, and more. Use your Apple ID or create a new account to start using Apple services.

 ![图片](https://forumcdn.freemdict.com/uploads/default/original/3X/7/7/773b59f4e2eab938535e7dc47a81320ab63779f6.jpeg)

---

<div class="post-metadata">

作者： ![leebye](https://forumcdn.freemdict.com/letter_avatar_proxy/v4/letter/l/4bbf92/32.png) [@leebye](https://forum.freemdict.com/u/leebye)\
发布日期： [2022 年10 月 31 日 12:42 UTC](https://forum.freemdict.com/t/topic/16055/139 "2022-10-31T12:42:43Z")

</div>

这么说我手机不显示旗子是欧路软件自身的缺陷了？奇怪你的居然可以显示，是因为用的开发版系统吗？

---

<div class="post-metadata">

作者： ![startle](https://forumcdn.freemdict.com/user_avatar/forum.freemdict.com/startle/32/22231_2.png) [@startle](https://forum.freemdict.com/u/startle)\
发布日期： [2022 年10 月 31 日 13:23 UTC](https://forum.freemdict.com/t/topic/16055/140 "2022-10-31T13:23:07Z")

</div>

肯定不是，因为浏览器也能正常显示，MDict 与 GoldenDict 也可以。

---

<div class="post-metadata">

作者： ![维天有汉](https://forumcdn.freemdict.com/letter_avatar_proxy/v4/letter/%E7%BB%B4/51bf81/32.png) [@维天有汉](https://forum.freemdict.com/u/%E7%BB%B4%E5%A4%A9%E6%9C%89%E6%B1%89)\
发布日期： [2022 年10 月 31 日 14:05 UTC](https://forum.freemdict.com/t/topic/16055/141 "2022-10-31T14:05:32Z")

</div>

😂我解决了。都可以正常显示了。有个中文名的css没删 😂

---

<div class="post-metadata">

作者： ![维天有汉](https://forumcdn.freemdict.com/letter_avatar_proxy/v4/letter/%E7%BB%B4/51bf81/32.png) [@维天有汉](https://forum.freemdict.com/u/%E7%BB%B4%E5%A4%A9%E6%9C%89%E6%B1%89)\
发布日期： [2022 年10 月 31 日 14:11 UTC](https://forum.freemdict.com/t/topic/16055/142 "2022-10-31T14:11:58Z")

</div>

国旗也出来了

---

<div class="post-metadata">

作者： ![维天有汉](https://forumcdn.freemdict.com/letter_avatar_proxy/v4/letter/%E7%BB%B4/51bf81/32.png) [@维天有汉](https://forum.freemdict.com/u/%E7%BB%B4%E5%A4%A9%E6%9C%89%E6%B1%89)\
发布日期： [2022 年10 月 31 日 14:14 UTC](https://forum.freemdict.com/t/topic/16055/143 "2022-10-31T14:14:52Z")

</div>

原来是我自己的问题

---

<div class="post-metadata">

作者： ![leebye](https://forumcdn.freemdict.com/letter_avatar_proxy/v4/letter/l/4bbf92/32.png) [@leebye](https://forum.freemdict.com/u/leebye)\
发布日期： [2022 年10 月 31 日 14:37 UTC](https://forum.freemdict.com/t/topic/16055/144 "2022-10-31T14:37:22Z")

</div>

跟中文名有关？我的mdx和mdd都是含中文名的

 ![IMG_20221031_223808](https://forumcdn.freemdict.com/uploads/default/original/3X/6/e/6ef8aeb17ce5f10e8c6c5c4fa647ef8bb493542b.jpeg)

那为什么我PC端现在用相同文件是可以正常的呢

[上一页](https://forum.freemdict.com/t/topic/16055.md?page=6)

[下一页](https://forum.freemdict.com/t/topic/16055.md?page=8)
