怎样用css写出圆形边框

html-css09

怎样用css写出圆形边框,第1张

1、首先打开sublime text编辑器,新建一个html文件,里面写入一个p标签:

2、然后设置p标签的样式,这里先设置一个边框,然后设置圆角边框,主要使用CSS3属性border-radius属性定义圆角效果。其中的数值为参数length是浮点数和单位标识符组成的长度值,不可为负值,这里圆角的值越大,圆角的弧度也越大:

3、最后打开浏览器,就可以看到圆角边框了:

border-radius:像素

CSS3里面 这个是圆角属性,但是最主流的IE浏览器都不认识,所以LZ还是放弃吧。

处理圆角一般采用两种方式

1、一个是PS切圆角,然后作为背景图片放到页面中。

2、第二个就是采用一个累计效果,也可以定义出圆角。

这里有个例子:http://zhidao.baidu.com/question/128969067.html

下面也有我的回答,LZ感兴趣可以研究研究,很简单。

用到了这条代码:border-radius-left,top,bottom,right

例子如下:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/htmlcharset=utf-8" />

<title>无标题文档</title>

</head>

<body>

<div style="border:3px #000 solidborder-top-right-radius:10pxborder-top-left-radius:5pxborder-bottom-left-radius:6pxborder-bottom-right-radius:20pxwidth:50pxheight:50pxbackground:#f60"></div>

<div style="border:3px #000 solidborder-radius:10pxwidth:50pxheight:50pxbackground:#fff"></div>

</body>

</html>