drop a shadow and outline the text.


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. <script>
  2. <!–
  3.  
  4. var message=”Both”;
  5. var thickness=1;
  6. var color2=”black”;
  7. var color1=”white”;
  8. var color3=”gray”;
  9. var extra=”font-size:40px;”;
  10. var range=5;
  11. var z = range;
  12. var d = range;
  13. var x = -thickness;
  14. var y = -thickness;
  15.  
  16. while (y<=thickness) {
  17. while (x<=thickness) {
  18.  
  19. document.write (”<span style=’”+extra+” color:”+color2+”; position:absolute; left:”+x+”; top:”+(-y)+”;’>”+message+”</span>”);
  20. document.write (”<span style=’”+extra+” color:”+color2+”; position:absolute; left:”+x+”; top:0;’>”+message+”</span>”);
  21. document.write (”<span style=’”+extra+” color:”+color2+”; position:absolute; left:”+x+”; top:”+y+”;’>”+message+”</span>”);
  22.  
  23. x=x+1;
  24. }
  25. y=y+1;
  26. }
  27.  
  28. document.write (”<span style=’”+extra+” color:”+color3+”; position:absolute\; left:”+z+”; top:”+d+”;’>”+message+”</span>”);
  29. document.write (”<span style=’”+extra+” color:”+color1+”; position:absolute; left:0; top:0;’>”+message+”</span>”);
  30.  
  31. //–>
  32. </script>

URL: http://stylizedweb.com/2008/01/13/outline-text-with-js/

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.