为什么最后一行代码颜色不显示?求解答!

img


犬瘟热体育i哦怕SD法国红酒哭了自行车爸爸妈妈呢哈弗哈快上车送水果还是看会书测额客户就公司上市刚上完课宝宝睡觉上过课

img


放到外面的div试试看看效果

你前面几个盒子用float:left 和float:right浮动,最后一个盒子没有浮动,所以它被前面的盒子覆盖住了,只要给最后一个盒子加个浮动即可,如果他有帮助给个采纳谢谢

<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <div style="background-color: #007aff; width: 500px;">
    <div style="background-color: #0000ff;width: 500px;height: 100px;">1</div>
    <div style="background-color: #00ff00;width: 100px;height: 200px;float: left;">2y</div>
    <div style="background-color: #ffff7f;width: 400px;height: 200px;float:right;">2z</div>
    <div style="background-color: #ff5500;width: 500px;height: 200px;float: left;">3</div>
  </div>
</body>

</html>

img