文本用html字体和颜色绑定自己的动画

时间:2014-05-02 02:01:09

标签: html css animation

我想让我的页面使用文本输入动画,所以我找到了下面的代码。问题是我不知道如何将html字体放入其中,例如

 <span style="color:#a52a2a;"><strong>HTML TEXT</strong></span>

那我该怎么做?提前致谢

&#13;
&#13;
<html>

<head>
  <style type="text/css">
    #myTypingText {
      width: 700px;
      height: 120px;
      padding: 12px;
      color: #800000;
      font-family: Arial, Helvetica, sans-serif;
      font-size: 16px;
      line-height: 1.5em;
    }
  </style>
</head>

<body>
  <div id="myTypingText"></div>
  <script>
    var myString = "Place your string data here, and as much as you like.";
    var myArray = myString.split("");
    var loopTimer;

    function frameLooper() {
      if (myArray.length > 0) {
        document.getElementById("myTypingText").innerHTML += myArray.shift();
      } else {
        clearTimeout(loopTimer);
        return false;
      }
      loopTimer = setTimeout('frameLooper()', 70);
    }
    frameLooper();
  </script>
</body>

</html>
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:0)

您可以在CSS中设置font-weight。

#myTypingText {
    font-weight:bold;
    width:700px;
    height:120px;
    padding:12px;
    color:#800000;
    font-family:Arial, Helvetica, sans-serif;
    font-size:16px;
    line-height:1.5em;
}