Q:

How do I add css to a line like document.write(text[0]);

I've already tried this:
document.write(<div class="line01"> + text[0] + </div>);

A:

That looks ok as far as the CSS goes, but the elements to output should be in a string:
Change this:
document.write(<div class="line01"> + text[0] + </div>);

To this:
document.write('<div class="line01">' + text[0] + '</div>');

More on document.write can be found here

