<body> <div class="q1"></div> <div class="q2"></div>
<body>
<style> .q1{ width: 100px; height: 100px; border-color: salmon; border-style: dotted; } .q2{ width: 200px; height: 200px; border-top: 3px hidden green; border-right: 5px bisque dotted; border-bottom: 10px double fuchsia; border-left: 12px dashed #4e4dff; } </style>
效果图
![](https://i-blog.csdnimg.cn/blog_migrate/9bcfa7ce2ba4f751bdda8d187084461d.jpeg)
备注:要求边框按照上右下左的顺序编写
常用的边框格式为:dashed() double() dotted() solid() unset() hidden() dot-dash() dot-dot-dash() groove()inset()
内边框的移动
padding
.q3{ width: 200px; height: 200px; background-color: tomato; padding: 10px 20px 30px 40px; } .q4{ width: 100px; height: 100px; background-color: green; } .q5{ width: 50px; height: 50px; background-color: grey; padding-top: 20px; padding-right: 20px; }
效果