An Interest In:
Web News this Week
- March 22, 2024
- March 21, 2024
- March 20, 2024
- March 19, 2024
- March 18, 2024
- March 17, 2024
- March 16, 2024
March 5, 2011 03:23 am GMT
Original Link: http://feedproxy.google.com/~r/nettuts/~3/bW9AVuzDXwM/
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:
Tweet
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