欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

弹性盒flex的使用

程序员文章站 2022-03-13 13:56:28
...
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>伸缩盒</title>
  6. <style>
  7. header{
  8. min-width: 1200px;
  9. height: 100px;
  10. display: flex;
  11. align-items: center;
  12. justify-content: space-around;
  13. }
  14. .logo{
  15. height: 100%;
  16. width: 200px;
  17. background: url("https://www.php.cn/static/images/PHPlogo.png") no-repeat;
  18. background-size: cover;
  19. }
  20. .nav{
  21. width: 800px;
  22. display: flex;
  23. justify-content: space-between;
  24. }
  25. .info{
  26. width: 100px;
  27. display: flex;
  28. align-items: center;
  29. justify-content: space-between;
  30. }
  31. .head_img{
  32. width: 50px;
  33. height: 50px;
  34. background: cornflowerblue;
  35. border-radius: 50%;
  36. line-height: 50px;
  37. text-align: center;
  38. color: #FF0000;
  39. }
  40. </style>
  41. </head>
  42. <body>
  43. <header>
  44. <div class="logo"></div>
  45. <div class="nav">
  46. <div class="nav_item">首页</div>
  47. <div class="nav_item">视频教程</div>
  48. <div class="nav_item">学习路径</div>
  49. <div class="nav_item">大前端</div>
  50. <div class="nav_item">资源下载</div>
  51. <div class="nav_item">技术文章</div>
  52. <div class="nav_item">社区</div>
  53. </div>
  54. <div class="info">
  55. <div class="msg">消息</div>
  56. <div class="head_img">头像</div>
  57. </div>
  58. </header>
  59. </body>
  60. </html>

弹性盒flex的使用