---
title: "CSS实现圆角的三种方法以下直接给出代码："
author: "piperzero"
date: "2008-05-19T02:20:00Z"
tags: []
slug: "css"
draft: false
lastmod: "2008-05-19T02:20:00Z"
id: 1010008
url: "https://piperzero.iteye.com/blog/1010008"
---

# [CSS实现圆角的三种方法](http://www.cnblogs.com/wmw1989/archive/2008/05/18/1202229.html)

以下直接给出代码：

第一种：

&lt;Html&gt;  
&lt;head&gt;  
&lt;style&gt;  
#a{  
border-left:1px #333 solid;  
border-right:1px #333 solid;  
width:300px;  
height:500px;  
}  
.b{  
height:1px;  
overflow:hidden;  
border-left:1px #333 solid;  
border-right:1px #333 solid;  
}  
&lt;/style&gt;  
&lt;/head&gt;  
&lt;body&gt;  
&lt;div&gt;  
&lt;div class="b" style="margin-left:3px;width:294px;background:#333"&gt;&lt;/div&gt;  
&lt;div class="b" style="margin-left:2px;width:296px;"&gt;&lt;/div&gt;  
&lt;div class="b" style="margin-left:1px;width:298px;"&gt;&lt;/div&gt;  
&lt;div id="a"&gt;  
&lt;/div&gt;  
&lt;/div&gt;  
&lt;/body&gt;  
&lt;/Html&gt;

第二种：

&lt;html&gt;  
&lt;head&gt;  
&lt;title&gt;css圆角效果&lt;/title&gt;  
&lt;meta http-equiv="content-type" c&gt;  
&lt;style type="text/css"&gt;  
div.RoundedCorner{background: #9BD1FA}  
b.rtop, b.rbottom{display:block;background: #FFF}  
b.rtop b, b.rbottom b{display:block;height: 1px;overflow: hidden; background: #9BD1FA}  
b.r1{margin: 0 5px}  
b.r2{margin: 0 3px}  
b.r3{margin: 0 2px}  
b.rtop b.r4, b.rbottom b.r4{margin: 0 1px;height: 2px}  
&lt;/style&gt;  
&lt;/head&gt;  
&lt;body&gt;  
&lt;div class="RoundedCorner"&gt;  
&lt;b class="rtop"&gt;&lt;b class="r1"&gt;&lt;/b&gt;&lt;b class="r2"&gt;&lt;/b&gt;&lt;b class="r3"&gt;&lt;/b&gt;&lt;b class="r4"&gt;&lt;/b&gt;&lt;/b&gt;  
&lt;br&gt;无图片实现圆角框&lt;br&gt;&lt;br&gt;  
&lt;b class="rbottom"&gt;&lt;b class="r4"&gt;&lt;/b&gt;&lt;b class="r3"&gt;&lt;/b&gt;&lt;b class="r2"&gt;&lt;/b&gt;&lt;b class="r1"&gt;&lt;/b&gt;&lt;/b&gt;  
&lt;/div&gt;  
&lt;/body&gt;  
&lt;/html&gt;

第三种：

&lt;style&gt;  
.divfloat {  
margin:0 0 10px 0;  
background: transparent;  
}

.roundtop,.roundbottom{  
display:block;  
font-size:1px;  
width: 100%;  
background:transparent;  
}

.roundb1,.roundb2,  
.roundb3,.roundb4 {  
display:block;  
overflow:hidden;  
}

.roundb1,.roundb2,.roundb3 {  
height:1px;  
border-left:1px solid #9B9B9B;  
border-right:1px solid #9B9B9B;  
background:#F3F3F3;  
}

.roundb1 {margin:0 5px;background:#9B9B9B;}  
.roundb2 {margin:0 3px;border-width:0 2px;}  
.roundb3 {margin:0 2px;}  
.roundb4 {  
height:2px;  
margin:0 1px;  
border-left:1px solid #9B9B9B;  
border-right:1px solid #9B9B9B;  
background:#F3F3F3;  
}

.roundboxcontent {  
display:block;  
padding:5px;  
height:100%;  
overflow:hidden;  
border:0 solid #9B9B9B;  
border-width:0 1px;  
background:#F3F3F3;  
}  
&lt;/style&gt;

&lt;div class="divfloat"&gt;  
&lt;b class="roundtop"&gt;  
&lt;b class="roundb1"&gt;&lt;/b&gt;  
&lt;b class="roundb2"&gt;&lt;/b&gt;  
&lt;b class="roundb3"&gt;&lt;/b&gt;  
&lt;b class="roundb4"&gt;&lt;/b&gt;  
&lt;/b&gt;  
&lt;div class="roundboxcontent"&gt;  
&lt;div class="sidebarwrap"&gt;  
这是圆角div内容部分...  
&lt;/div&gt;  
&lt;/div&gt;  
&lt;b class="roundbottom"&gt;  
&lt;b class="roundb4"&gt;&lt;/b&gt;  
&lt;b class="roundb3"&gt;&lt;/b&gt;  
&lt;b class="roundb2"&gt;&lt;/b&gt;  
&lt;b class="roundb1"&gt;&lt;/b&gt;  
&lt;/b&gt;  
&lt;/div&gt;