<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> <style> .outerDiv{ width: 500px; height: 303px; border: 1px solid greenyellow; background-color: rgb(165, 212, 212); } .innerDiv{ width: 100px; height: 100px; border: 1px solid rebeccapurple; /* float: left; */ } .d1{ background-color: bisque; /* 使用float达到浮动的效果 right就是靠右 */ float: right; } .d2{ background-color: rgba(0, 76, 255, 0.227); /* float: right; */ /* float: left; */ } .d3{ background-color: rgb(219, 167, 167); /* float: right; */ /* float: left; */ } </style> </head> <body> <div class="outerDiv"> <div class="innerDiv d1">框1</div> <div class="innerDiv d2">框2</div> <div class="innerDiv d3">框3</div> </div> </body> </html>