<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>绘制线性渐变</title>
<script>
function draw(id)
{
var context=document.getElementById('canvas').getContext('2d');
var lingrad=context.createLinearGradient(0,0,0,150);
lingrad.addColorStop(0,'black');
lingrad.addColorStop(1,'white');
context.fillStyle=lingrad;
context.fillRect(10,10,130,130);
}
</script>
</head>
<body οnlοad="draw('canvas');">
<h1>线性渐变</h1>
<canvas id="canvas" width="400" height="300"/>
</body>
</html>

最后
以上就是谦让凉面最近收集整理的关于html中线性渐变的全部内容,更多相关html中线性渐变内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复