博主信息
博文 28
粉丝 0
评论 0
访问量 18497
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
10.27日作业
子墨吖ฅฅ
原创
531人浏览过
  1. <!doctype html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport"
  6. content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
  7. <meta http-equiv="X-UA-Compatible" content="ie=edge">
  8. <title>Document</title>
  9. </head>
  10. <style>
  11. .container{
  12. width: 1000px;
  13. height: 500px;
  14. display: grid;
  15. /*设置容器为3列每列200px*/
  16. grid-template-columns: repeat(3, 200px);
  17. /*设置容器为3行每行30px*/
  18. grid-template-rows: repeat(3, 30px);
  19. /*设置容器内单元格默认居中*/
  20. place-items: center;
  21. /*设置行内间隙10px*/
  22. gap: 10px;
  23. }
  24. .container > .item1{
  25. font-weight: bolder;
  26. grid-area: 1 / 2 / span 1 / span 1;
  27. /*单独设置这个单元格为垂直居下,水平居中*/
  28. place-self: end center;
  29. }
  30. .container > .item2{
  31. grid-area: 2 / 3 / span 1 / span 1;
  32. /*单独设置这个单元格为默认*/
  33. place-self:start;
  34. }
  35. .container > .item3{
  36. grid-area: 3 / 2 / span 1 / span 1;
  37. }
  38. /*隐式表格*/
  39. .container > .item4{
  40. grid-area: 4 / 2 / span 1 / span 1;
  41. /*单独设置这个单元格格式,垂直默认,水平居中*/
  42. place-self: start center;
  43. }
  44. </style>
  45. <body>
  46. <div class="container">
  47. <div class="item1">《春晓》</div>
  48. <div class="item2">唐·孟浩然</div>
  49. <div class="item3">春眠不觉晓,处处闻啼鸟。</div>
  50. <div class="item4">夜来风雨声,花落知多少。</div>
  51. </div>
  52. </body>
  53. </html>

容器展示图

运行展示图

批改老师:PHPzPHPz

批改状态:合格

老师批语:很好,结合实例,效果可以
本博文版权归博主所有,转载请注明地址!如有侵权、违法,请联系admin@php.cn举报处理!
全部评论 文明上网理性发言,请遵守新闻评论服务协议
0条评论
作者最新博文
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号

  • 登录PHP中文网,和优秀的人一起学习!
    全站2000+教程免费学