划边线的几种思路

1. border

2. outline

outline 与border很像,但是outline支持偏移
outline 不占据空间,很牛B的特性,绘制于元素内容周围。
outline 通常是矩形,但也可以是非矩形的。

/* 颜色 | 样式 | 宽度 */
outline: green solid 3px;
/* 偏移 */
outline-offset: 10px;

3. background

background: linear-gradient(to right, #000000, #000000 5px, transparent 5px, transparent);

background-size 和 background-position可模拟位置,粗细,长短,颜色,渐变色等,但是不能实现删除线,因为是背景

4. text-decoration

可调整 样式,颜色,粗细,偏移(负值可实现删除线),位置

text-decoration-line: underline;
text-decoration-style: wavy;
text-decoration-color: red;
text-decoration-thickness: 0.1em;
text-underline-offset: -0.5em;
text-underline-position: under left;

 

posted @   全玉  阅读(10)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· AI技术革命,工作效率10个最佳AI工具
历史上的今天:
2019-08-16 svg的viewport和viewbox
2018-08-16 前端性能优化
2018-08-16 Phaser的timer用法
2016-08-16 ES6 import export
2016-08-16 gitingore配置样例
点击右上角即可分享
微信分享提示