HTML与CSS手写-2.使用CSS绘制几何图形(圆形、三角形、扇形、菱形等)

使用CSS绘制几何图形(圆形、三角形、扇形、菱形等)

//圆形
<div class="circle"></div>
<style>
.circle {
  border-radius: 50%;
  width: 80px;
  height: 80px;
  background: #666;
}
//扇形
<div class="sector"></div>
<style>
.sector{
  border-radius:80px 0 0;
  width: 80px;
  height: 80px;
  background: #666;
}
</style>
//三角形
<style>
#triangle-up {
    width: 0;
    height: 0;
    border-left: 50px solid transparent;
    border-right: 50px solid transparent;
    border-bottom: 100px solid red;
}
</style>
//菱形
.rhombus{
            width: 100px;
            height: 100px;
            transform: rotateZ(45deg)skew(30deg,30deg);
            background: blue;
        }

 

posted @ 2023-03-05 17:11  不想做混子的奋斗远  阅读(146)  评论(0)    收藏  举报