Html 如何制作带有圆角的div
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7106970/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to make a div with rounded corners
提问by user23557676
How do you make a div so that it's border's corners are rounded?
你如何制作一个 div 使其边框的角变圆?
Thanks everyone!
谢谢大家!
回答by SilverHorn
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>
–SilverHorn
——银号角
回答by kriscross07
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,但您可以尝试使用您喜欢的像素数量。
回答by sleepyup
add this css:
添加这个css:
border-top-right-radius:15px;
border-top-left-radius:15px;
border-bottom-right-radius:15px;
border-bottom-left-radius:15px;
回答by aaplmath
Use the border-radius
property. The higher the specified amount (typically in px
), the more rounded your shape. Example:
使用border-radius
物业。指定的数量越高(通常在 中px
),您的形状就越圆润。例子:
myDiv { border-radius:30px;}
Hope that helps.
希望有帮助。