Albert Renshaw
Albert Renshaw

Reputation: 17882

CSS MultiLined Gradient Text. -webkit-background-clip

I am using CSS to generate a gradient on my text... The problem is my text is multi-lined so the gradient doesn't reset on each line... the whole paragraph becomes 1 huge gradient! Can I get an individual gradient effect for each line of text in my divider? Here is my code:

<html>
<head>
<style type='text/css'>p.p1 {
    margin: 0.0px 0.0px 0.0px 50.0px; 
    font: 50.0px Helvitica; 
    font-family: 'HelveticaNeue-Light', 'Helvetica Neue Light', 'Helvetica Neue', 'Helvetica, Arial', 'Lucida Grande', 'sans-serif'; 
    background: -webkit-gradient(linear, left top, left bottom, from(#eee), to(#333)); 
    -webkit-background-clip: text; 
    -webkit-text-fill-color: transparent;
    }
</style>
</head>
<body bgcolor='#FFFFFF'>
<div style='word-wrap: break-word;'>
<p class='p1'>
<font face='helvetica' color='#000000'>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi id vestibulum lectus. Maecenas facilisis orci vitae urna pulvinar cursus. Etiam id laoreet metus. Cras vitae elit ipsum. Donec a sagittis nisi. Sed nec nisi nibh, fringilla fermentum quam. Vestibulum lorem felis, gravida et faucibus ac, ultrices nec lectus.
</font>
</p>
</div>
</body>
</html>

Upvotes: 1

Views: 2403

Answers (1)

bookcasey
bookcasey

Reputation: 40433

I got rid of the deprecated tags and cleaned the code up for you..

p.p1 {
    margin: 0 0 0 50px; 
    font-size: 50px; 
    font-family: 'HelveticaNeue-Light', 'Helvetica Neue Light', 'Helvetica Neue', 'Helvetica, Arial', 'Lucida Grande', 'sans-serif'; 
    background: -webkit-repeating-linear-gradient(top, red 0px, blue 60px);
    -webkit-background-clip: text; 
    -webkit-text-fill-color: transparent;
    }

Demo

Upvotes: 2

Related Questions