Convert Figma logo to code with AI

chokcoco logoiCSS

不止于 CSS

19,527
2,003
19,527
240

Top Related Projects

GitHub repo for the MDN Learning Area.

Documentation about css-modules

28,437

Transforming styles with JS plugins

4,702

A modular minifier, built on top of the PostCSS ecosystem.

Quick Overview

The chokcoco/iCSS repository is a collection of CSS techniques and effects, showcasing the power and versatility of CSS. It provides a wide range of examples and demonstrations, covering various aspects of CSS, from animations and transformations to creative layouts and visual effects.

Pros

  • Comprehensive Collection: The repository offers a diverse range of CSS examples, catering to developers of all skill levels, from beginners to experts.
  • Innovative Techniques: The project showcases innovative and creative CSS techniques, pushing the boundaries of what can be achieved with CSS alone.
  • Visual Inspiration: The project serves as a valuable source of inspiration for developers looking to enhance the visual appeal and interactivity of their web applications.
  • Well-Documented: The repository includes detailed explanations and code snippets for each example, making it easy for users to understand and implement the techniques.

Cons

  • Lack of Structured Organization: The repository can feel overwhelming due to the large number of examples, and it may be challenging to navigate and find specific techniques.
  • Limited Practical Applications: While the examples are visually impressive, some of the techniques may not be directly applicable to real-world web development projects.
  • Potential Performance Concerns: Some of the more complex CSS effects and animations may have performance implications, which should be considered when implementing them in production environments.
  • Dependency on Modern Browsers: Many of the techniques rely on the latest CSS features, which may not be supported by older or less-capable browsers.

Code Examples

Example 1: Animated Gradient Background

body {
  background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
  background-size: 400% 400%;
  animation: gradient 15s ease infinite;
}

@keyframes gradient {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

This code creates an animated gradient background that smoothly transitions between different colors, creating a visually striking effect.

Example 2: 3D Cube Rotation

.cube {
  width: 200px;
  height: 200px;
  position: relative;
  transform-style: preserve-3d;
  transform-origin: 100px 100px;
  animation: rotate 10s linear infinite;
}

.face {
  position: absolute;
  width: 200px;
  height: 200px;
  opacity: 0.8;
}

@keyframes rotate {
  from { transform: rotateX(-30deg) rotateY(45deg); }
  to { transform: rotateX(330deg) rotateY(405deg); }
}

This code creates a 3D cube that rotates continuously, demonstrating the power of CSS transformations and animations.

Example 3: Glitch Text Effect

.glitch {
  position: relative;
  color: white;
  font-size: 4em;
  letter-spacing: 0.5em;
  animation: glitch 2s infinite;
}

@keyframes glitch {
  2%, 64% {
    transform: translate(2px, 0);
  }
  4%, 60% {
    transform: translate(-2px, 0);
  }
  62% {
    transform: translate(0, 0);
  }
}

This code creates a glitch text effect, where the text appears to be distorted and flickering, adding a unique and visually striking element to the design.

Getting Started

To get started with the chokcoco/iCSS repository, follow these steps:

  1. Clone the repository to your local machine:
git clone https://github.com/chokcoco/iCSS.git
  1. Navigate to the project directory:
cd iCSS
  1. Open the project in your preferred code editor and explore the various CSS examples and techniques.

  2. To view the examples in your web browser, you can either:

    • Open the individual HTML

Competitor Comparisons

GitHub repo for the MDN Learning Area.

Pros of mdn/learning-area

  • Comprehensive coverage of web development topics, including HTML, CSS, JavaScript, and more.
  • Detailed explanations and step-by-step tutorials for beginners.
  • Actively maintained and updated by the Mozilla Developer Network (MDN) team.

Cons of mdn/learning-area

  • Less focused on specific CSS techniques and effects compared to iCSS.
  • May not provide as much in-depth exploration of advanced CSS concepts.
  • The learning area is spread across multiple repositories, which may make it less cohesive.

Code Comparison

iCSS:

.box {
  width: 200px;
  height: 200px;
  background-color: #f1f1f1;
  border-radius: 50%;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.box:hover {
  transform: scale(1.1);
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.2);
}

learning-area:

<section class="hero">
  <div class="hero-body">
    <div class="container">
      <h1 class="title">
        Welcome to our website!
      </h1>
      <h2 class="subtitle">
        Explore our amazing content.
      </h2>
    </div>
  </div>
</section>

Documentation about css-modules

Pros of css-modules/css-modules

  • Provides a way to scope CSS to specific components, reducing the risk of naming conflicts and global styles.
  • Integrates well with popular build tools like Webpack, Rollup, and Parcel.
  • Supports dynamic class names, allowing for more flexible and programmatic styling.

Cons of css-modules/css-modules

  • Requires additional setup and configuration, which can be a barrier for some developers.
  • Might not be as intuitive for developers who are used to traditional global CSS.
  • Can make it more difficult to debug and inspect styles in the browser.

Code Comparison

iCSS

.box {
  width: 100px;
  height: 100px;
  background-color: #ccc;
  transition: all 0.3s;
}

.box:hover {
  transform: scale(1.2);
}

css-modules

.box {
  width: 100px;
  height: 100px;
  background-color: #ccc;
  transition: all 0.3s;
}

.box:hover {
  transform: scale(1.2);
}

The main difference between the two is that css-modules uses a unique class name generated by the build tool, while iCSS uses a traditional class name. This allows css-modules to provide better scoping and avoid naming conflicts.

28,437

Transforming styles with JS plugins

Pros of PostCSS

  • PostCSS is a widely-used and well-established CSS processing tool, with a large and active community.
  • It provides a modular and extensible architecture, allowing developers to easily integrate various plugins to enhance their CSS workflow.
  • PostCSS has excellent documentation and a wealth of available plugins, making it a versatile and powerful choice for CSS processing.

Cons of PostCSS

  • The learning curve for PostCSS can be steeper than some other CSS processing tools, as it requires understanding the plugin ecosystem and configuration.
  • The flexibility of PostCSS can also be a drawback, as the wide range of available plugins can make it challenging to choose the right ones for a specific project.

Code Comparison

PostCSS:

const postcss = require('postcss');
const autoprefixer = require('autoprefixer');

postcss([autoprefixer])
  .process(css, { from: 'src/app.css', to: 'dist/app.css' })
  .then(result => {
    fs.writeFileSync('dist/app.css', result.css);
    if (result.map) fs.writeFileSync('dist/app.css.map', result.map);
  });

iCSS:

const iCSS = require('icss');

const result = iCSS.parse(`
  .foo {
    color: red;
    font-size: 16px;
  }
`);

console.log(result.css); // Output: ".foo{color:red;font-size:16px}"
console.log(result.map); // Output: { ... }
4,702

A modular minifier, built on top of the PostCSS ecosystem.

Pros of cssnano/cssnano

  • cssnano is a modular CSS optimiser that can be used as a PostCSS plugin, making it easy to integrate into existing build processes.
  • cssnano provides a wide range of optimisation techniques, including minification, compression, and removal of unused CSS.
  • cssnano is actively maintained and has a large community of contributors, ensuring ongoing development and support.

Cons of cssnano/cssnano

  • cssnano may not be as visually engaging or interactive as iCSS, which focuses more on creative CSS techniques.
  • The documentation for cssnano may not be as comprehensive or user-friendly as that of iCSS, which is known for its detailed and well-organized tutorials.

Code Comparison

cssnano/cssnano:

.example {
  font-size: 16px;
  color: #333;
  padding: 10px 20px;
}

After optimization:

.example{font-size:16px;color:#333;padding:10px 20px}

iCSS:

.example {
  background: linear-gradient(45deg, #f44336, #e91e63);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-size: 3rem;
  font-weight: bold;
}

This code creates a gradient text effect, which is a more creative and visually engaging CSS technique compared to the basic minification performed by cssnano.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

logo

CSS 奇技淫巧,在这里,都有。

本 Repo 围绕 CSS/Web动画 展开,谈一些有趣的话题,内容天马行空,想到什么说什么,不仅是为了拓宽解决问题的思路,更涉及一些容易忽视或是十分有趣的 CSS 细节。

所有内容都在 Issues 中,同步更新到我的个人博客,觉得不错的可以点个 star 收藏支持。

按分类进行阅读

Background Border clip-path Mask Shadow Shape 混合模式 滤镜 伪类

CSS Layout CSS Function CSS-Houdini CSS Variable CSS 新特性 CSS-doodle Modern CSS

动效 动画 可访问性 3D 效果 图片效果 文字效果 边框效果

SVG 奇技淫巧 性能 技巧 浏览器特性 特殊交互 用户体验 翻译 设计 面试 Bug

iCSS 前端趣闻

所有内容首发更新到我的公众号,以及 iCSS 有高质量微信群聊,感兴趣不要错过:

LIST

215、全尺寸的带圆角的渐变边框

214、巧妙使用多种方式实现单侧阴影

213、渐变边框文字效果?CSS 轻松拿捏!

212、【动画进阶】神奇的卡片 Hover 效果与 Blur 的特性探究

211、【动画进阶】类 ChatGpt 多行文本打字效果

210、【现代 CSS】标准滚动条控制规范 scrollbar-color 和 scrollbar-width

209、【动画进阶】极具创意的鼠标交互动画

208、【动画进阶】巧用 CSS/SVG 实现复杂线条光效动画

207、【布局进阶】巧用 :has & drop-shadow 实现复杂布局效果

206、现代 CSS 解决方案:accent-color 强调色

205、【动画进阶】神奇的 3D 卡片反光闪烁动效

204、现代 CSS 解决方案:文字颜色自动适配背景色!

203、带圆角的虚线边框?CSS 不在话下

202、【布局技巧】Flex 布局下居中溢出滚动截断问题

288605244-2228ef21-e75c-4d5c-ae31-c472bf20e947

201、CSS 也能实现 if 判断?实现动态高度下的不同样式展现

200、【动画进阶】单标签下多色块随机文字随机颜色动画

199、CSS 还原拉斯维加斯球数字动画

198、【动画进阶】神奇的背景,生化危机4日食 Loading 动画还原

197、【动画进阶】当路径动画遇到滚动驱动!

196、现代 CSS 解决方案:原生嵌套(Nesting)

195、现代 CSS 解决方案:数学函数 Round

194、震惊!CSS 也能实现碰撞检测?

193、抢先体验!超强的 Anchor Positioning 锚点定位

192、神奇的 3D 磨砂玻璃透视效果

258775149-4247cd7b-7b36-43d7-9231-f1490e0c442b

191、【动画进阶】有意思的 Emoji 3D 表情切换效果

190、【动画进阶】有意思的网格下落渐次加载效果

189、解放生产力!transform 支持单独赋值改变

188、单标签下的日间/黑夜模式切换按钮效果

187、现代 CSS 解决方案:CSS 原生支持的三角函数

186、有意思的气泡 Loading 效果

185、有趣的六芒星能力图动画

184、CSS 高阶小技巧 - 角向渐变的妙用!

183、巧用 CSS 变量,实现动画函数复用,制作高级感拉满的网格动画

182、CSS 高阶技巧 -- 不定宽文本溢出跑马灯效果完美解决方案

181、由小见大!不规则造型按钮解决方案

180、动态视口单位之 dvh、svh、lvh

179、开局一张图,构建神奇的 CSS 效果

178、巧用视觉障眼法,还原 3D 文字特效

177、不规则图形背景排版高阶技巧 -- 酷炫的六边形网格背景图

176、现代 CSS 高阶技巧,不规则边框解决方案

175、现代 CSS 高阶技巧,完美的波浪进度条效果!

174、现代 CSS 高阶技巧,像 Canvas 一样自由绘图构建样式!

173、现代 CSS 之高阶图片渐隐消失术

172、除了 filter 还有什么置灰网站的方式?

171、快速构建 3D Visualization of DOM

170、CSS at-rules(@) 规则扫盲

169、CSS 渐变锯齿消失术

168、超强的苹果官网滚动文字特效实现

167、超强的纯 CSS 鼠标点击拖拽效果

166、两道超有意思的 CSS 面试题,试试你的基础

165、单标签实现复杂的棋盘布局

164、新时代布局新特性 -- 容器查询

163、有意思的水平横向溢出滚动

162、高阶 CSS 技巧在复杂动效中的应用

161、有意思的方向裁切 overflow: clip

160、巧用 transition 实现短视频 APP 点赞动画

159、妙啊!纯 CSS 实现拼图游戏

158、多行文本下的文字渐隐消失术

157、使用 CSS 构建强大且酷炫的粒子动画

156、妙用 CSS 构建花式透视背景效果

155、圆角大杀器,使用滤镜构建圆角及波浪效果!

154、超酷炫的转场动画?CSS 轻松拿下!

153、利用噪声构建美妙的 CSS 图形

152、高阶切图技巧!基于单张图片的任意颜色转换

151、使用纯 CSS 实现超酷炫的粘性气泡效果

150、超 Nice 的表格响应式布局小技巧

149、有意思的鼠标指针交互探究

148、使用 content-visibility 优化渲染性能

147、文字轮播与图片轮播?CSS 不在话下

146、动画小技巧,通过 hover 让动画只运行一次且停留在最后一帧

145、浅谈逻辑选择器 is、where、not、has

144、现代 CSS 解决方案:CSS 数学函数

143、离谱的 CSS!从表盘刻度到艺术剪纸

142、让交互更加生动!有意思的鼠标跟随 3D 旋转动效

141、Amazing!巧用 CSS 视差实现酷炫交互动效

140、现代 CSS 解决方案:Modern CSS Reset

139、巧用 background-clip 实现超强的文字动效

138、一道有意思的 CSS 面试题,FizzBu​​zz ~

137、2022 年最受瞩目的新特性 CSS @layer 到底是个啥?

136、CSS 阴影进阶,实现更加的立体的阴影效果!

135、利用混合模式,让文字智能适配背景颜色

134、系统性学习 CSS 指南及全 DEMO 练习

133、巧用 CSS 构建渐变彩色二维码

132、来了来了,它终于来了,动画杀手锏 @scroll-timeline

131、突破限制,CSS font-variation 可变字体的魅力

130、小技巧 | 渐变消失遮罩的多种实现方式

129、巧用 CSS 实现炫彩三角边框动画

128、扫盲贴:2021 CSS 最冷门特性都是些啥?

127、疑难杂症:运用 transform 导致文本模糊的现象探究

126、LPL Ban/Pick 选人阶段的遮罩效果是如何实现的?

125、巧用 CSS 实现动态线条 Loading 动画

124、深入浅出 CSS 动画

123、妙用滤镜构建高级感拉满的磨砂玻璃渐变背景

122、深入探讨 filter 与 backdrop-filter 的异同

121、Amazing!!CSS 也能实现烟雾效果?

120、Amazing!!CSS 也能实现极光?

119、神奇的滤镜!巧妙实现内凹的平滑圆角

118、利用 clip-path 实现动态区域裁剪

117、使用 CSS 轻松实现一些高频出现的奇形怪状按钮

116、巧用渐变实现高级感拉满的背景光动画

115、巧用滤镜实现高级感拉满的文字快闪切换效果

114、3D 穿梭效果?使用 CSS 轻松搞定

113、仅仅使用 HTML/CSS 实现进度条的 N 种方式

112、CSS 奇技淫巧 | 巧妙实现文字二次加粗再加边框

111、利用 CSS Overview 面板重构优化你的网站

110、小技巧 | 一行代码实现头像与国旗的融合

109、CSS 奇技淫巧 | 妙用 drop-shadow 实现线条光影效果

108、CSS 奇技淫巧 | 妙用混合模式实现文字镂空波浪效果

107、妙用 background 实现花式文字效果

106、实现一个会动的鸿蒙 LOGO

105、巧用模糊实现文字的 3D 效果

104、奇思妙想 CSS 3D 动画 | 仅使用 CSS 能制作出多惊艳的动画?

103、CSS 奇思妙想 | 使用 resize 实现强大的图片拖拽切换预览功能

102、CSS 即将支持嵌套,SASS/LESS 等预处理器已无用武之地?

101、【Web动画】科技感十足的暗黑字符雨动画

100、CSS 世界中的方位与顺序

99、巧妙的实现带圆角的三角形

98、CSS 奇思妙想 | 全兼容的毛玻璃效果

97、试试酷炫的 3D 视角

96、Web 动画原则及技巧浅析

95、CSS ::marker 让文字序号更有意思

94、Single Div 绘图技巧

93、新时代创意布局不完全指南

92、有意思的 ::maker 伪元素

91、使用 CSS prefers-* 规范,提升网站的可访问性与健壮性

90、小技巧!CSS 提取图片主题色功能探索

89、一种巧妙的使用 CSS 制作波浪效果的思路

88、探秘神奇的曲线动画 motion-path

87、新时代布局中一些有意思的特性

86、CSS 还能这样玩?奇思妙想渐变的艺术

85、CSS @property,让不可能变可能

84、CSS 文字装饰 text-decoration & text-emphasis

83、老生常谈之 CSS 实现三角形

82、巧用 SVG 滤镜制作有意思动效

81、有意思!不规则边框的生成方案

80、小技巧!CSS 整块文本溢出省略特性探究

79、奇思妙想 CSS 文字动画

78、巧用 -webkit-box-reflect 倒影实现各类动效

77、使用 mask 实现视频弹幕人物遮罩过滤

76、你可能不知道的 transition 技巧与细节

75、CSS奇思妙想 -- 使用 CSS 创造艺术图案

74、生僻标签 fieldset 与 legend 的妙用

73、CSS 奇思妙想边框动画

72、CSS 技巧一则:动态高度过渡动画

71、如何不使用 overflow: hidden 实现 overflow: hidden?

70、水平垂直居中深入挖掘

69、一行 CSS 代码的魅力

68、使用纯 CSS 实现滚动阴影效果

67、探究 position-sticky 失效问题

66、CSS 艺术 -- 使用 background 创造各种美妙的背景

bg9

65、使用 tabindex 配合 focus-within 巧妙实现父选择器

64、CSS 技巧一则 -- 不定宽溢出文本适配滚动

textscroll

63、奇妙的 CSS MASK

62、使用 display: contents 增强页面语义

61、CSS 故障艺术

60、巧妙实现带圆角的渐变边框

59、深入理解 CSS(Cascading Style Sheets)中的层叠(Cascading)

58、巧用 CSS 实现酷炫的充电动画

57、使用 sroll-snap-type 优化滚动

56、在 CSS 中使用三角函数绘制曲线图形及展示动画

55、CSS 阴影动画优化技巧一则

54、Web 字体 font-family 再探秘

53、你所不知道的 CSS 负值技巧与细节

52、A Guide to CSS Rules

51、CSS 属性选择器的深入挖掘

50、探秘 flex 上下文中神奇的自动 margin

49、巧妙使用 CSS 控制动画行进

48、CSS 火焰,不在话下

47、不可思议的纯 CSS 实现鼠标跟随

46、有趣的 box-decoration-break

45、不可思议的纯 CSS 进度条效果

44、探究 CSS 混合模式\滤镜导致 CSS 3D 失效问题

43、你所不知道的 CSS 阴影技巧与细节

42、滚动视差? CSS不在话下

41、神奇的选择器 :focus-within

40、Pure CSS Button Effect

39、妙用 scale 与 transfrom-origin,精准控制动画方向

38、不可思议的纯 CSS 导航栏下划线跟随效果

如何使用纯 CSS 制作下述下划线跟随效果?

underline

37、两行 CSS 代码实现图片任意颜色赋色技术

36、text-fill-color 与 color 的异同

35、你所不知道的 CSS 滤镜技巧与细节

34、你所不知道的 CSS 动画技巧与细节

33、fixed 定位失效 || 不受控制的 position:fixed

32、CSS 新特性contain,控制页面的重绘与重排

31、纯 CSS 实现波浪效果!

CSSWaVe

30、奇妙的 CSS shapes(CSS图形)

29、不可思议的混合模式 background-blend-mode

28、不可思议的混合模式 mix-blend-mode

27、神奇的 conic-gradient 角向渐变

26、奇妙的-webkit-background-clip: text

25、vh、vw、vmin、vmax 知多少

24、纯 CSS 实现瀑布流布局

23、谈谈 CSS 关键字 initial、inherit 和 unset

22、纯 CSS 方式实现 CSS 动画的暂停与播放

21、提高 CSS 动画性能的正确姿势 | 盒子端 CSS 动画性能提升研究

20、巧妙地制作背景色渐变动画!

如何实现下述的背景色渐变动画?

lineargradient

19、深入探讨 CSS 特性检测 @supports 与 Modernizr

18、使用 position:sticky 实现粘性布局

17、再探究字体的渲染规则及 fallback 机制

16、你该知道的字体 font-family

15、reset.css 知多少

14、CSS命名方式是否有必要规范

13、引人瞩目的 CSS 自定义属性(CSS Variable)

12、结构性伪类选择器

11、IFC、BFC、GFC 与 FFC 知多少

10、巧妙的实现 CSS 斜线

使用单个标签,如何实现下图所示的斜线效果:

CSS slash

9、巧妙的多列等高布局

规定下面的布局,实现多列等高布局,要求两列背景色等高。

<div class="container">
    <div class="left">多列等高布局左</div> 
    <div class="right">多列等高布局右</div>
</div>

8、纯CSS的导航栏Tab切换方案

不用 Javascript,使用纯 CSS 方案,实现类似下图的导航栏 Tab 切换:

纯CSS的导航栏切换方案

7、全兼容的最后一条边界线问题

看看下图,常见于一些导航栏中,要求每行中最后一列的右边框消失,如何在所有浏览器中最便捷最优雅的实现?

6、全兼容的多列均匀布局问题

如何实现下列这种多列均匀布局:

image

5、纯 CSS 实现单行居中显示文字,多行居左显示,最多两行超过用省略号结尾

image

4、从倒影说起,谈谈 CSS 继承 inherit

3、层叠顺序(stacking level)与堆栈上下文(stacking context)知多少?

2、类似下面这样的条纹边框,只使用一个标签,可以有多少种实现方式 -- 从条纹边框的实现谈盒子模型:

image

1、下面这个左边竖条图形,只使用一个标签,可以有多少种实现方式:

image

Stargazers over time

Stargazers over time