[英]How to make a div with rounded corners
你如何制作一个 div 使其边框角变圆?
Here it is:这里是:
<style type="text/css">
div.test
{
width: 115px;
padding: 10px;
border: 2px solid #000;
border-radius: 15px;
-moz-border-radius: 15px;
}
</style>
<div class="test">This is some text!</div>
With CSS add the code: border-radius: 10px
.使用 CSS 添加代码:
border-radius: 10px
。
I use 10px for example, but you can experiment with however amount of pixels you like.例如,我使用 10px,但您可以尝试使用您喜欢的像素数量。
add this css:添加这个css:
border-top-right-radius:15px;
border-top-left-radius:15px;
border-bottom-right-radius:15px;
border-bottom-left-radius:15px;
Use the border-radius
property.使用
border-radius
属性。 The higher the specified amount (typically in px
), the more rounded your shape.指定的数量越高(通常以
px
),您的形状就越圆润。 Example:例子:
myDiv { border-radius:30px;}
Hope that helps.希望有帮助。
如果你不想依赖像素,你可以随时使用 %
border-radius: 50%;
例如,使用CSS 3就是这个例子
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.