终于懂得了在html的段落里面改变字体状态了

今天下午,捣鼓了一下终于明白了这么在段落<h>的标签里改变字体的状态了,比如字体颜色字体属性等。

原来只用在<h1>的标题里加上“style”代码后面跟属性值就可以改变字体状态了。

例如:

<!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" />
<meta http-equiv="refresh" content="1" />
<meta name="keywords" content="无标题文档">
<meta name="description" content="无标题文档">
<title>无标题文档</title>
<script type="text/javascript">
//创建一个date对象
var today = new Date();
//取出年月日
var year = today.getFullYear();
var month = today.getMonth()+1;
var day = today.getDate();
//获取毫秒数
var milliSec = today.getMilliseconds();
var milliSec2 = today.getTime();
//将日期信息,链接成一个字符串
var str = "<h1 style=\"color:red\">今天是"+year+"年"+month+"月"+"日";
str += "毫秒数:"+milliSec+"距离1970年毫秒数:"+milliSec2;
str +="</h1>";
document.write(str);
</script>
</head>
<body>
</body>
</html>

这样就可以修改字体的颜色了。

本文来自投稿,不代表科技代码立场,如若转载,请注明出处https://www.cwhello.com/759.html

如有侵犯您的合法权益请发邮件951076433@qq.com联系删除

(0)
上一篇 2016年5月20日 14:28
下一篇 2016年5月22日 00:00

相关推荐

联系我们

QQ:951076433

在线咨询:点击这里给我发消息邮件:951076433@qq.com工作时间:周一至周五,9:30-18:30,节假日休息