【问题标题】:How do I add a text shadow with CSS2 [closed]如何使用 CSS2 添加文本阴影 [关闭]
【发布时间】:2016-02-26 17:09:02
【问题描述】:

显然,在 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:图片不会显示。

【问题讨论】:

  • 你想为 ie7 设计一些样式吗?
  • @Aaron 在 Dreamweaver 上做。
  • 但是您要在现代浏览器中打开它吗?
  • @Aaron Chrome 48.0.2564.116
  • 文本阴影工作正常...color: #CF0 - jsfiddle.net/pbhvah8a 后缺少分号

标签: css shadow


【解决方案1】:

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

在浏览器中预览?

点击下方的运行代码按钮。

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

更新

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

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

【讨论】:

  • 我应该说我正在使用 .text 和调用类,而不是使用上面显示的内容。
  • 看我的编辑,应该很清楚了。
  • @bleh 你把那个类分配给你想要设计的东西了吗?
  • 在浏览器中打开您的 html/php,您应该会看到应用的阴影。如果没有,请检查您的类中没有拼写错误,并且 CSS 样式和类都使用相同的“小写”格式。 @bleh
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-09-07
相关资源
最近更新 更多