繁体   English   中英

如何制作带圆角的div

[英]How to make a div with rounded corners

你如何制作一个 div 使其边框角变圆?

这里是:

<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>

使用 CSS 添加代码: border-radius: 10px

例如,我使用 10px,但您可以尝试使用您喜欢的像素数量。

添加这个css:

border-top-right-radius:15px;
border-top-left-radius:15px;
border-bottom-right-radius:15px;
border-bottom-left-radius:15px;

使用border-radius属性。 指定的数量越高(通常以px ),您的形状就越圆润。 例子:

myDiv { border-radius:30px;}

希望有帮助。

如果你不想依赖像素,你可以随时使用 %

border-radius: 50%;

例如,使用CSS 3就是这个例子

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM