calc() 用法类似于函数,能够给元素设置动态的值:
/* basic calc */ .simpleBlock { width: calc(100% - 100px); } /* calc in calc */ .complexBlock { width: calc(100% - 50% / 3); padding: 5px calc(3% - 2px); margin-left: calc(10% + 10px); } 文本渐变文本渐变效果很流行,使用 CSS3 能够很简单就实现:
h2[data-text] { position: relative; } h2[data-text]::after { content: attr(data-text); z-index: 10; color: #e3e3e3; position: absolute; top: 0; left: 0; -webkit-mask-image: -webkit-gradient(linear, left top, left bottom, from(rgba(0,0,0,0)), color-stop(50%, rgba(0,0,0,1)), to(rgba(0,0,0,0)));} 禁用鼠标事件CSS3 新增的 pointer-events 让你能够禁用元素的鼠标事件,例如,一个连接如果设置了下面的样式就无法点击了。
.disabled { pointer-events: none; } 模糊文本简单但很漂亮的文本模糊效果,简单又好看!
.blur { color: transparent; text-shadow: 0 0 5px rgba(0,0,0,0.5); }原文:https://segmentfault.com/a/1190000003936841