<!DOCTYPE html>
<head>
<title> Oval shape</title>
</head>
<body>
<div style="width:400px; height:400px; background-color:#ff0;">Oval</div>
<p> This is Oval shape by using html5, css3.</p>
<body>
</html>
我写了这样的代码..我希望div标签为椭圆形......你能告诉我......
答案 0 :(得分:3)
HTML
<div id="oval">Oval</div> <p> This is Oval shape by using html5, css3.</p>
CSS
#oval {
width: 200px;
height: 100px;
background: red;
-moz-border-radius: 100px / 50px;
-webkit-border-radius: 100px / 50px;
border-radius: 100px / 50px;
}
请参阅以下链接
答案 1 :(得分:0)
您可以使用border-radius来允许动态尺寸。我还要指出,这个css的前缀不存在
:
div{
height:100px;
width:200px;
border-radius:50%;
background-color: #ff0;
}
&#13;
<div></div>
&#13;