博客列表 >PHP中文网首页导航栏右侧布局

PHP中文网首页导航栏右侧布局

P粉355147598
P粉355147598原创
2022年03月28日 16:48:02713浏览

PHP中文网首页导航栏右侧布局

效果图

整个代码太多,一下为右侧导航栏单独的html和css

html

  1. <div class="right">
  2. <div class="right-top">
  3. <a href=""><img src="static/images/user-pic.jpeg" alt="" /></a>
  4. <div class="right-top-name">
  5. <a href="#">faker.chen</a>
  6. <br />
  7. <span>P豆 亿点点</span>
  8. </div>
  9. <div class="my-class">
  10. <a href="">我的学习</a>
  11. </div>
  12. </div>
  13. <div class="right-bottom">
  14. <div class="news"><span>问答社区</span><a href="#" class="new"
  15. style="color: red; font-weight: bold;">答疑</a></div>
  16. <div class="news"><span>头条</span><a href="#" class="new">俄罗斯</a></div>
  17. <div class="news"><span>新课</span><a href="#" class="new">3.9号公益直播课</a></div>
  18. <div class="news"><span>新班</span><a href="#" class="new">19期PHP直播课</a></div>
  19. <div class="news"><span>招募</span><a href="#" class="new">课程合作计划</a></div>
  20. <div class="news"><span>公告</span><a href="#" class="new">APP上线啦</a></div>
  21. </div>
  22. </div>
  23. <div class="bottom-right">
  24. <div><a href="#"></a>
  25. <span>官方公众号</span>
  26. </div>
  27. <div><a href="#"></a>
  28. <span>官方QQ群</span>
  29. </div>
  30. </div>

css

  1. /* right-top */
  2. main .navs .right {
  3. display: grid;
  4. grid-template-rows:140px 1fr ;
  5. padding: 20px;
  6. row-gap: 10px;
  7. }
  8. main .navs .right-top {
  9. display: grid;
  10. /* grid-template-rows: repeat(2 , 1fr); */
  11. grid-template-columns: 40px 1fr;
  12. place-items: center;
  13. }
  14. main .navs .right .right-top img {
  15. width: 100%;
  16. border-radius: 100%;
  17. }
  18. main .navs .right .right-top .right-top-name span {
  19. color: #999;
  20. }
  21. main .navs .right .right-top .right-top-name a {
  22. font-weight: bold;
  23. color: #000;
  24. }
  25. main .navs .right .right-top .right-top-name a:hover {
  26. color: red;
  27. }
  28. main .navs .right .right-top .my-class {
  29. grid-column: span 2;
  30. background-color: #f11717;
  31. height: 30px;
  32. width: 150px;
  33. border-radius: 20px;
  34. font-size: 15px;
  35. font-weight: bold;
  36. color: #ffffff;
  37. text-align: center;
  38. line-height: 30px;
  39. }
  40. main .navs .right .right-top .my-class a {
  41. color: #fff;
  42. }
  43. main .navs .right .right-bottom {
  44. display: grid;
  45. grid-template-rows: repeat(6 , 1fr);
  46. place-items: center start;
  47. }
  48. main .navs .right .right-bottom a {
  49. color: #999;
  50. padding-left: 10px;
  51. }
  52. main .navs .right .right-bottom a:hover {
  53. color: red;
  54. }
  55. /* main .navs .right .right-bottom .news .new :first-of-type {
  56. color: red;
  57. font-weight: bold;
  58. 好像优先级有问题
  59. } */
  60. main .navs .bottom-right {
  61. display: grid;
  62. grid-template-columns: repeat(2,1fr);
  63. /* grid-template-rows: repeat(2,1fr); */
  64. place-items: center;
  65. font-weight: bold;
  66. }
  67. main .navs .bottom-right a {
  68. position: relative;
  69. top: -15px;
  70. left: 45%;
  71. }
  72. main .navs .bottom-right span {
  73. position: relative;
  74. top: 20px;
  75. right: 7px;
  76. }
  77. 代码还有许多地方自认为做的不好 需要优化
声明:本文内容转载自脚本之家,由网友自发贡献,版权归原作者所有,如您发现涉嫌抄袭侵权,请联系admin@php.cn 核实处理。
全部评论
文明上网理性发言,请遵守新闻评论服务协议