我想做一个椭圆形:
但是当我使用这段代码时:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html"; charset="utf-8" />
<title>Oval</title>
<style type="text/css">
.oval {
width: 160px;
height: 80px;
background: #a84909;
border-radius: 40px;
}
</style>
</head>
<body>
<div class="oval"></div>
</body>
</html>
它给了我这个:
做一个圆圈是可行的,但做一个椭圆不行。
发布于 2014-11-17 03:48:05
您需要做的就是将border-radius: 40px
更改为border-radius: 50%
。
.oval {
width: 160px;
height: 80px;
background: #a84909;
border-radius: 50%;
}
<div class="oval"></div>
发布于 2014-11-17 03:44:55
使用百分比作为边界半径,如:border-radius: 50%;
。
发布于 2014-11-17 03:45:30
试试这个:
.oval {
width: 160px;
height: 80px;
background: #a84909;
moz-border-radius: 80px / 40px;
webkit-border-radius: 80px / 40px;
border-radius: 80px / 40px;
}
PS。我的前面没有编译器,所以可能会有一些小错误。
https://stackoverflow.com/questions/26961221
复制相似问题