how to give border to text in css code example

Example 1: how to make border for letters in css

h1 {
    /* 1 pixel black shadow to left, top, right and bottom */
    text-shadow: -1px 0 black, 0 1px black, 1px 0 black, 0 -1px black;

    font-family: sans; color: yellow;
}

Example 2: how to make border for letters in css

h1 {
    -webkit-text-stroke: 2px black; /* width and color */

    font-family: sans; color: yellow;
}

Example 3: how to add a border around text in html

<p style="border:3px; border-style:solid; border-color:#FF0000; padding: 1em;">
  First example with text surrounded by a red border.<br>This example also has multiple lines.
</p>

Example 4: how to make a text with a border in css

h1{
    width:30px;
    margin-top:-10px;
    margin-left:5px;
    background:white;
}

/* Change the values to achieve what design you want */

Tags:

Html Example