百度百科边框的定义:https://baike.baidu.com/item/css边框
CSS盒模型中的边框所在位置:位于外边距和内边距的中间
在学校初次学习边框时,老师是这样讲的:边框是环绕在标签宽度和高度周围的线条
基本属性(border):边框宽度、边框样式、边框颜色
边框倒角(border-radius)
边框阴影(box-shadow)
轮廓属性(outline)
a. 最简洁,也是最常用的方式
border: width style color;
b. 给某一个方向的边框设置 宽度、样式、颜色
border-方向: width style color;
/** 实线 **/
border-top: 1px solid red;
/** 虚线 **/
border-right: 2px dashed green;
/** 点状边框 **/
border-bottom: 3px dotted blue;
/** 去除左边框 **/
border-left: none;
c. 给四个方向的边框设置不同的属性值
border-属性:上 右 下 左;
border-width: 上 右 下 左;
border-style: 上 右 下 左;
border-color: 上 右 下 左;
d. 给某一个边框单独设置某个属性
border-方向-属性: 属性值;
border-top-width: 5px;
border-right-style: solid;
a. 作用:设定盒子模型四个角的圆弧角度
border-radius: 左上 右上 右下 左下;
b. 属性值说明
四个值:左上角 右上角 右下角 左下角 两个值:x轴 y轴 一个值:四个角的圆弧角度
1.% 设定x,y轴长度都是宽高的50% 2.px 一个具体数值,表示同时设定x轴,y轴的半径 3.x轴/y轴 第一个属性值表示x轴半径数值的设定,第一个属性值表示y轴半径数值的设定
c. 画图形
标准圆:正方形边框x轴、y轴倒角都取50%
时边框变为圆
<style>
div {
width: 150px;
height: 150px;
border: 2px solid red;
border-radius: 50%;
}
</style>
<div></div>
椭圆形: 宽是高的两倍,边框倒角取50%
时边框变为椭圆
<style>
div {
width: 300px;
height: 150px;
border: 2px solid red;
border-radius: 50%;
}
</style>
<div></div>
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有