套三层div,每个div通过父级的div进行绝对定位,至于圆点,可以使用独立的div通过绝对百分比定位,固定在相应位置。 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title></title> <style type="text/css"> .box { position: relative; /* 这个一定要,否则里面的box1-3会以body对齐 */ height: 200px; width: 200px; padding: 5px; } .box1, .box2, .box3 { position: absolute; top: 5px; bottom: 5px; left: 5px; right: 5px; border-radius: 7px; border: 2px solid rgb(204, 104, 177); } .circle { position: absolute; height: 30px; width: 30px; border-radius: 50%; background-color: rgb(164, 288, 255); } .circle1 { left: 50%; bottom: 0; margin-left: -15px; } </style> </head> <body> <div class="box"> <div class="box1"> <div class="box2"> <div class="box3"></div> </div> </div> <div class="circle circle1"></div> </div> </body> </html> 效果:
套三层
div
,每个div
通过父级的div
进行绝对定位,至于圆点,可以使用独立的div
通过绝对百分比定位,固定在相应位置。效果:
