Search code examples
cssshadow

How do I add a text shadow with CSS2


So apparently, in CSS3, there is a CSS command that goes like

text-shadow: 10px 10px 5px #color;

It creates a shadow on the text.

It doesn't work in CSS.

So how do I make a shadow in CSS?

This is what I have

.Stuff{
    text-shadow: 5px 5px 2px #000;
}

EDIT: At this point, I think I'm going to reveal my whole program.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">

.TitleMotto {
    font-family: "Parry Hotter";
    font-size: 36px;
    font-style: normal;
    line-height: single;
    text-transform: none;
    background-color: #F00;
    color: #CF0
    text-shadow: 5px 5px 2px #000;

}
.Motto {
    font-family: "Parry Hotter";
    font-size: 24px;
    font-style: normal;
    line-height: single;
    text-transform: none;
    background-color: #F00;
    color: #CF0
}
</style>
</head>

<body><table width="815" border="1">
  <tr>
    <td width="281" height="104"><img src="file:///E|/Business Project/Business_Logo (2).jpg" width="299" height="172" alt="Logo" /></td>
        <td width="518" class="Motto"><center>
          <div class="TitleMotto">Stuff</div>
          <p>Stuff</p>
        </center></td>
      </tr>
      <tr>
        <td height="543">&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
    </table>

    </body>

PS: the image won't show.


Solution

  • Your code is working fine. You don't need to specify the type of CSS you're using unlike HTML the browser either reads the CSS or ignores it.

    Preview it in your browser?

    Click the run code button below.

    .stuff {text-shadow: 5px 5px 2px #000;}
    <p class="stuff">text with a shadow</p>

    UPDATED

    By adding your full CSS code I can see that you have a missing closing semi-colon.

    color: #CF0; // ADD YOUR CLOSING SEMI-COLON HERE
    text-shadow: 5px 5px 2px #000;