语法:

属性 取值 默认值
voice-volume <number> | <percentage> | silent | x-soft | soft | medium | loud | x-loud | inherit medium
voice-balance <number> | left | center | right | leftwards | rightwards | inherit center
speak none | normal | spell-out | digits | literal-punctuation | no-punctuation | inherit normal
pause-before, pause-after <time> | none | x-weak | weak | medium | strong | x-strong | inherit implementation dependent
pause [ <'pause-before'> || <'pause-after'> ] | inherit implementation dependent
rest-before, rest-after <time> | none | x-weak | weak | medium | strong | x-strong | inherit implementation dependent
rest [ <'rest-before'> || <'rest-after'> ] | inherit implementation dependent
cue-before, cue-after <uri> [<number> | <percentage> | silent | x-soft | soft | medium | loud | x-loud] | none | inherit none
cue [ <'cue-before'> || <'cue-after'> ] | inherit not defined for shorthand properties
mark-before, mark-after <string> none
mark [ <'mark-before'> || <'mark-after'> ] not defined for shorthand properties
voice-family [[<specific-voice> | [<age>] <generic-voice>] [<number>],]* [<specific-voice> | [<age>] <generic-voice>] [<number>] | inherit implementation dependent
voice-rate <percentage> | x-slow | slow | medium | fast | x-fast | inherit implementation dependent
voice-pitch <number> | <percentage> | x-low | low | medium | high | x-high | inherit medium
voice-pitch-range <number> | x-low | low | medium | high | x-high | inherit implementation dependent
voice-stress strong | moderate | none | reduced | inherit moderate
voice-duration <time> implementation dependent
phonemes <string> implementation dependent

说明:

规定哪一块可以让机器来阅读。

voice-volume:
设置音量
voice-balance:
设置声音平衡
speak:
设置阅读类型
pause-before, pause-after:
设置暂停时的效果
pause:
设置暂停
rest-before, rest-after:
设置休止时的效果
rest:
设置休止
cue-before, cue-after:
设置提示时的效果
cue:
设置提示
mark-before, mark-after:
设置标注时的效果
mark:
设置标注
voice-family:
设置语系
voice-rate:
设置比率
voice-pitch:
设置音调
voice-pitch-range:
设置音调范围
voice-stress:
设置重音
voice-duration:
设置音乐持续时间
phonemes:
设置音位

兼容性:

类型 IEInternet Explorer FirefoxFirefox ChromeChrome OperaOpera SafariSafari
版本 (×)IE6 (×)Firefox 2.0 (×)Chrome 1.0.x (√)Opera 9.63 (×)Safari 3.1
(×)IE7 (×)Firefox 3.0 (×)Chrome 2.0.x (×)Safari 4
(×)IE8

示例:

    
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Language" content="utf-8" />
<meta name="robots" content="all" />
<meta name="author" content="Tencent-ISRD" />
<meta name="Copyright" content="Tencent" />
<title>Speech</title>
<style type="text/css">
#speech-sample {voice-family: male;}
#voice-volume { -xv-voice-volume: x-soft; -xv-voice-balance: right; }
#voice-balance { -xv-voice-balance: left; }
#speech-cue { cue-after: url(img/ding.wav); }
#voice-rate { -xv-voice-rate: x-slow; }
#voice-family { voice-family: female; }
#voice-pitch { -xv-voice-pitch: x-low; }
#speech-speak { speak: spell-out; }
</style>
</head>
<body>
<div>
<div id="speech-sample" style="border: 1px solid #666; padding:5px; font-size:14px;">This is an example sentence styled with several CSS properties, including <span id="voice-volume">voice-volume,</span> <span id="voice-balance">voice-balance,</span> <span id="voice-rate">voice-rate,</span> <span id="voice-family">voice-family,</span> <span id="voice-pitch">voice-pitch,</span> <span id="speech-speak">speak</span> and <span id="speech-cue">cue-after.</span></div>
</div>
</body>
</html>
 

快速跳转