1.align-itmes:flex-start 则从上到下;

image.png

  1. .box{
  2. width: 200px;
  3. height: 200px;
  4. border: 1px solid red;
  5. margin: 100px auto;
  6. display: flex;
  7. flex-direction:row;
  8. justify-content:space-between;
  9. align-items:flex-start;
  10. }
  11. .box span{
  12. display: inline-block;
  13. width: 30px;
  14. height: 30px;
  15. background-color: pink;
  16. border-radius: 50%;
  17. }

2.align-itmes:flex-end 从下到上

image.png

  1. .box{
  2. width: 200px;
  3. height: 200px;
  4. border: 1px solid red;
  5. margin: 100px auto;
  6. display: flex;
  7. flex-direction:row;
  8. justify-content:space-between;
  9. align-items:flex-end;
  10. }
  11. .box span{
  12. display: inline-block;
  13. width: 30px;
  14. height: 30px;
  15. background-color: pink;
  16. border-radius: 50%;
  17. }

3.align-itmes:center 垂直居中

image.png

  1. .box{
  2. width: 200px;
  3. height: 200px;
  4. border: 1px solid red;
  5. margin: 100px auto;
  6. display: flex;
  7. flex-direction:row;
  8. justify-content:space-between;
  9. align-items:center;
  10. }
  11. .box span{
  12. display: inline-block;
  13. width: 30px;
  14. height: 30px;
  15. background-color: pink;
  16. border-radius: 50%;
  17. }

4.align-items:stretch 拉伸 (不设置高)

image.png

  1. .box{
  2. width: 200px;
  3. height: 200px;
  4. border: 1px solid red;
  5. margin: 100px auto;
  6. display: flex;
  7. flex-direction:row;
  8. justify-content:space-between;
  9. align-items:stretch;
  10. }
  11. .box span{
  12. display: inline-block;
  13. background-color: pink;
  14. }