# 如何在网页中实现圆形？

0

luckydd | 初学一级 | 园豆：77

0

0
``` 1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2 <html xmlns="http://www.w3.org/1999/xhtml">
4     <title></title>
5     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6     <meta http-equiv="Content-Language" content="zh-CN" />
7 <style>
8 .cpanel div.icon span{-moz-transition-duration: 0.8s;background-color: #FFFFFF;background-position: -30px 50%;border: 1px solid #CCCCCC;border-radius: 60px;color: #565656;display: block;float: left;height: 100px;width: 100px;text-align:center;text-indent:0;}
9 .cpanel div.icon span:hover{border:1px solid blue;}
10 </style>
12 <body>
13 <div class="cpanel">
14     <div class="icon">
15         <span>abc</span>
16     </div>
17 </div>
18 </body>
19 </html>```

@blog_doudou: 自己试试不就知道了，我晕

@饥饿定义我: 试过了，真的是正方形。

0

<!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">
<title> New Document </title>
<script src="Scripts/jquery-1.4.1.js" type="text/javascript"></script>
<script type="text/javascript">
\$(function () {
var can = document.getElementById("can");
var ctx = can.getContext("2d");

ctx.beginPath();

ctx.arc(75, 75, 50, 0, Math.PI * 2, true); // 外圈
ctx.stroke(); //使用ctx.fill();就是填充色；

})
</script>

<body>
<canvas id="can" width="150" height="150"></canvas>
</body>
</html>

您需要登录以后才能回答，未注册用户请先注册