找回密码
 立即注册
搜索
查看: 242|回复: 1

纯CSS描边字 转自马黑教程专版

[复制链接]

1692

主题

3491

回帖

1万

积分

管理员

积分
14259
发表于 2026-10-30 01:07:53 | 显示全部楼层 |阅读模式

.strokeText {
   text-align: center;
   font: bold 4em sans-serif;
   text-stroke: 2px red;
   -webkit-text-stroke: 2px red;
   color: green;
}

1692

主题

3491

回帖

1万

积分

管理员

积分
14259
 楼主| 发表于 2026-10-30 01:09:08 | 显示全部楼层

效果:

霜染枫丹欢迎你

代码:

.strokeText {
   text-align: center;
   font: bold 4em sans-serif;
   text-stroke: 2px red;
   -webkit-text-stroke: 2px red;
   color: green;
}

分析:

实现描边字的关键在于 text-stroke 属性。该属性尚处于实验阶段,所以需要前缀 -webkit- 方能生效,目前,火狐浏览器、基于chromium内核的所有浏览器均支持该属性。

此法,适用于 font-size 设置为较大的文本,字号过小描边效果不佳。

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

协同嘉业科技有限公司 ( 京ICP备2024053108号-1 )

GMT+8, 2026-11-29 11:34 , Processed in 0.088918 second(s), 26 queries .

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表