1.边框属性
1.简写方式
border:width style color;
width: 以px为单位
div{width:200px; /*定义边框的宽度*/
height:150px; /*定义边框的高度*/
border:2px solid rgb(153, 0, 255)} /*border:边框线像素 样式 颜色*/
</style>
style取值
solid 代表实线
dotted 代表点状虚线
dashed 代表块状虚线
#d1{width:200px;
height:150px;
border:2px solid rgb(153, 0, 255)}
#d2{width:200px;
height:150px;
border:2px dotted rgb(0, 255, 242)}
#d3{width:200px;
height:150px;
border:2px dashed rgb(153, 0, 0)}
</style>
color
取值
英文
16进制
rgb
rgba
transparent 代表透明的颜色
2.单边框定义
border-方向:width style color(border对应分别是宽度 样式 颜色中间空格隔开。)
方向取值
top
right
bottom
left
div{width:200px;
height:100px;
border-top:1px solid red;
border-right:1px dashed green;
border-bottom:1px dotted orange;
border-left:1px dashed pink;
}
3.单属性设置
语法
border-属性
属性取值
width:
style:
color:
border:0 去除边框
div{width:100px;
height:60px;
border-width:1px;
border-style:dotted;
border-color:rgba(255,0,255,0.6)}
</style>
首先进行边框大小的width和height设置,然后逐一设置border的width,style和color。
扫码关注腾讯云开发者
领取腾讯云代金券
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. 腾讯云 版权所有