<html lang="en">
<head>
<meta charset="UTF-8">
<title>锯齿图</title>
<script type="text/javascript">
window.addEventListener("load", eventWindowLoaded, false)
function eventWindowLoaded(){
var x,y
var theCanvas = document.getElementById("canvas")
var context = theCanvas.getContext("2d")
context.strokeStyle = '#CB9A61'
context.lineWidth=10
context.strokeRect(10, 10, theCanvas.width-20, theCanvas.height-20)
context.fillStyle = "#FFFFFF"
for(x=5x<=canvas.widthxx=x+10){
context.beginPath()
context.arc(x,5,5,0,Math.PI*2,true)
context.arc(x,canvas.height-5,5,0,Math.PI*2,true)
context.closePath()
context.fill()
}
for(y=5y<=canvas.heightyy=y+10){
context.beginPath()
context.arc(5,y,5,0,Math.PI*2,true)
context.arc(canvas.width-5,y,5,0,Math.PI*2,true)
context.closePath()
context.fill()
}
}
</script>
</head>
<body>
<div style="position: absolutetop: 100pxleft: 100px">
<canvas id="canvas" width="400" height="170" top=50pxleft=50px>
</div>
</body>
</html>
估计你是初学者吧,当时我学习的时候也有过这种疑问。这些内容在css里面会讲到的。<div> <div> <div /> <div />这样就可以了。
其实等你学到css以后就全明白了 努力学习吧
<div style="background-color:redborder-radio:10pxwidth:100%height:100%border-radius: 10px"></div>
主要做圆角用border-radius这个样式。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)