Search code examples
htmlcsstextborder

Color around the Text in HTML


I needed to show color around the text in my HTML page, I tried border property but it is giving square box around the Text. How to achieve below requirement

enter image description here

Thanks.


Solution

  • I would write the code here... But this link http://line25.com/articles/using-css-text-shadow-to-create-cool-text-effects explains it so well.

    Example Demo : http://codepen.io/anon/pen/CDsFb

    This is actually much better ...

    text-shadow: 3px 3px 0 #000,
        /* Simulated effect for Firefox and Opera and nice enhancement for WebKit */
       -3px -3px 0 #000,  
        3px -3px 0 #000,
       -3px  3px 0 #000,
        3px  3px 0 #000;
    

    This will ensure it looks like a proper border you want and not a simple glow around your text.