怎样用css写出圆形边框

html-css09

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

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

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

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

CSS 实现让div的四个边框都有阴影的效果:

首先:

HTML代码

<h1>CSS 如何实现让div的四个边框都有阴影的效果?</h1>

<div class="g1">

<div class="g2"></div>

</div>

CSS代码

body{background:#f00}

html{background:#f00}/*html加背景色*/

.g1{

width:500px

height:500px

border:2px solid #fff

margin:30px auto

background-color:#fff

box-sizing:border-box

}

.g2{

width:400px

height:400px

margin:50px auto

border:2px solid #000

box-shadow:5px 5px 5px #000,5px -5px 5px #000,-5px 5px 5px #000,-5px -5px 5px #000

}

具体效果: