对应有border-right、border-top、border-bottom
1 <head> 2 <meta charset="utf-8"> 3 <title>css边框和背景</title> 4 <style type="text/css"> 5 body{background: url(img/我爱你.jpg) no-repeat fixed} 6 p{border: 3px dashed #13E1F3;width: 100px;height: auto} 7 </style> 8 </head> 9 10 <body> 11 <p>你好!爱情</p> 12 </body>
注意同一级属性可以在上一级属性中同时定义,如{background: url(img/我爱你.jpg) no-repeat fixed}定义了background-image、background-repeat、background-attachment。这样做可简化代码