如何使用 CSS2 添加文本阴影

How do I add a text shadow with CSS2

显然,在 CSS3 中,有一个 CSS 命令类似于

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

它在文本上创建了一个阴影。

它在 CSS 中不起作用。

那么如何在 CSS 中制作阴影?

这就是我的

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

编辑:在这一点上,我想我要公开我的整个程序。

<!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: 图片无法显示。

您的代码运行良好。您不需要指定您正在使用的 CSS 的类型,这与 HTML 不同,浏览器要么读取 CSS 要么忽略它。

在浏览器中预览?

单击下面的 运行 代码按钮。

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

已更新

通过添加完整的 CSS 代码,我可以看到您缺少结束分号。

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