From a72a21c688c7664a48e2a7130043b5533e33ad3b Mon Sep 17 00:00:00 2001 From: sevichecc <91365763+Sevichecc@users.noreply.github.com> Date: Mon, 30 Jan 2023 00:01:05 +0800 Subject: [PATCH] new post --- urara/2023-01-29-css-tricks/+page.svelte.md | 121 ++++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 urara/2023-01-29-css-tricks/+page.svelte.md diff --git a/urara/2023-01-29-css-tricks/+page.svelte.md b/urara/2023-01-29-css-tricks/+page.svelte.md new file mode 100644 index 00000000..d4c55ebd --- /dev/null +++ b/urara/2023-01-29-css-tricks/+page.svelte.md @@ -0,0 +1,121 @@ +--- +title: CSS · 玻璃按钮和优雅的文字描边 +created: 2023-01-29 +summary: Glass buttons and elegant text stroke +tags: + - CSS Trick +--- + +## 1.玻璃按钮 + +### 来源 + +[Fediverse Fetch Analyzer](https://midnight-productive-sunset.glitch.me/l/organic-interest) + +### 效果 + +
Elegant-text-shadow
+ +### 思路 + +- 用两个多重投影重合后未覆盖的部分作为灰色描边。 +- 用 text-shadow 来做,当有两个 text-shadow 的时候,可以做多重投影 +- `text-shadow:水平阴影,垂直阴影,模糊距离,阴影颜色` +- 从上到下的投影: + - 上 `2px 2px 0 #fff` 白色 (和文字背景颜色一样) + - 下 `3px 3px 0 #ddd` 灰色 +- 两个投影偏移的距离越大,描边越粗。不过我感觉,1px 的差距比较像描边。 + +### 代码 + +```css title='css' +p { + font-family: serif; + font-style: italic; + font-size: 4rem; + text-shadow: 2px 2px 0 #fff, 3px 3px 0 #ddd; +} +``` + +```html title='html' +Elegant-text-shadow
+``` + +CodePen:[elegant-text-stroke](https://codepen.io/sevichee/pen/OJwwgry) + +