Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
March 5, 2011 03:23 am GMT

Quick Tip: Nonintrusive CSS Text Gradients


Though not completely cross browser compatible, there are ways to nonintrusively create pure CSS text-gradients with a bit of trickery. The key is to use a mix of attribute selectors, webkit-specific properties, and custom HTML attributes.


Final Simple HTML

Hello World

By using custom attributes, we can then hook into these values from within our stylesheet by using the attr() function.


Final CSS

/* Select only h1s that contain a 'data-text' attribute */h1[data-text] {position: relative;        color: red;}h1[data-text]::after {content: attr(data-text);z-index: 2;color: green;position: absolute;left: 0;-webkit-mask-image: -webkit-gradient(linear,left top, left bottom,from(rgba(0,0,0,1)),color-stop(40%, rgba(0,0,0,0)));

Original Link: http://feedproxy.google.com/~r/nettuts/~3/bW9AVuzDXwM/

Share this article:    Share on Facebook
View Full Article

TutsPlus - Code

Tuts+ is a site aimed at web developers and designers offering tutorials and articles on technologies, skills and techniques to improve how you design and build websites.

More About this Source Visit TutsPlus - Code