元素的边框(border)是围绕元素内容和内边距的一条或多条线。 CSS border属性允许你规定元素边框的样式、宽度和颜色。
1、border-width: 设置边框宽度
2、border-style: 设置边框样式
none 没有边框
solid 实线
dotted 点线
dashed 虚线
3、border-color :设置边框颜色
4、borde具体属性设置:
border-top-color:green;
5、border属性联写
改变具体边框属性联写:
border-top:2px dotted red;
改变所有边框属性联写:
border:1 px solid green;
6、去掉边框写法:
border: 0 none;
代码:
<title>边框属性border</title>
<style>
div{
width: 200px;
height: 200px;
background-color: red;
/*border-style: solid;!*必须属性*!*/
/*border-width: 5px;*/
/*border-color: purple;*/
/*border: 5px solid purple;!*简写属性*!*/
/*border-top-style: dashed;*/
/*border-top-color: purple;*/
/*border-top-width: 5px;*/
border-top: 5px dashed purple;
/*border-bottom-style: dotted;*/
/*border-bottom-width: 5px;*/
/*border-bottom-color: pink;*/
border-bottom: 5px dotted pink;
/*border-left-style: solid;*/
/*border-left-width: 5px;*/
/*border-left-color: palegoldenrod;*/
border-left: 5px solid palegoldenrod;
/*border-right-style: double; !*最小宽度3px*!*/
/*border-right-width: 5px;*/
/*border-right-color:green;*/
border-right: 5px double green;
}
</style>
</head>
<body>
<div></div>
</body>
</html>