1500字范文,内容丰富有趣,写作好帮手!
1500字范文 > 如何使用纯CSS实现锡纸撕开的文字效果(code)

如何使用纯CSS实现锡纸撕开的文字效果(code)

时间:2020-03-07 06:52:24

相关推荐

如何使用纯CSS实现锡纸撕开的文字效果(code)

web前端|css教程

background,flex,css,html5,前端

web前端-css教程

本篇文章给大家带来的内容是关于如何使用纯CSS实现锡纸撕开的文字效果(附代码) ,有一定的参考价值,有需要的朋友可以参考一下,希望对你有所帮助。

信息管理 asp 源码,vscode控制台控制按键,ubuntu安装vmare,添加新的tomcat,爬虫调查风暴,linux上搭建php,平潭搜索引擎seo公司,导航网站网址lzw

效果预览

数字时钟插件源码,安装ubuntu 微星,tomcat8 中文 乱码,写爬虫如何,php 如何写app接口,新手学习seo怎么用外推劫持lzw

jquery源码视频,vscode对齐代码快捷键,检查ubuntu版本,发布到tomcat下,node爬虫详解,为什么搭建php环境,seo推广从哪里获得数据,手机旅游网站源码lzw

源代码下载

/comehope/front-end-daily-challenges

代码解读

定义 dom,容器中包含若干子元素,每个子元素中包含一个字母:

A W E S O M E

定义容器尺寸:

body { margin: 0; height: 100vh;}.text { width: 100%; height: 100%;}

设置子元素的布局方式:

.text { display: flex; justify-content: space-between;}.text span { width: 100%;}

定义文本样式:

.text span { color: darkslategray; background-color: rgb(127, 140, 141); font-family: serif; font-size: 12vmin; text-shadow: 1px 1px 1px white; display: flex; align-items: center; justify-content: center;}

设置文本的背景的渐变色,奇数位的文字和偶数位的文字的渐变方向是相反的:

.text span:nth-child(odd) { background: linear-gradient( to bottom, rgba(127, 140, 141, 0.2) 0%, rgba(127, 140, 141, 0) 33%, rgba(127, 140, 141, 0.7) 66%, rgba(127, 140, 141, 0.2) 100% );}.text span:nth-child(even) { background: linear-gradient( to top, rgba(127, 140, 141, 0.2) 0%, rgba(127, 140, 141, 0) 33%, rgba(127, 140, 141, 0.7) 66%, rgba(127, 140, 141, 0.2) 100% );}

增加文字之间的分隔线,第1个文字之前不用加分隔线:

.text span { position: relative;}.text span:not(:first-child)::before { content: \; position: absolute; width: 10px; height: 90%; background-color: black; left: -5px; border-left: 1px solid white; border-radius: 50%;}

让分隔线上下错位:

.text span:not(:first-child):nth-child(odd)::before { top: 2%;}.text span:not(:first-child):nth-child(even)::before { bottom: 2%;}

大功告成!

如何用纯CSS实现接扎啤的特效(附源码)

如何使用纯CSS实现一个沙漏的动画效果

如何使用css实现监控网络连接状态的页面

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。