无忧启动论坛

 找回密码
 注册
搜索
系统gho:最纯净好用系统下载站投放广告、加入VIP会员,请联系 微信:wuyouceo
查看: 371|回复: 9
打印 上一主题 下一主题

[求助] 求助CSS高手,代码修改

[复制链接]
跳转到指定楼层
1#
发表于 10 小时前 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式
CSS代码,仿Chrome标签页(梯形标签页),用于文件管理软件Tablacus Explorer。显示效果:

想做些改进,主要是区分各个“非当前页”、完善梯形形状、自定义各种背景颜色,如图:



最终理想样式:



CSS代码(待修改)
  1. .tab, .tab2, .tab3,
  2. .tab:hover, .tab2:hover, .tab3:hover {
  3.   box-shadow: none;
  4. }

  5. .tab0 {
  6.   padding: 3px 0 0 12px;
  7.   background-color: ActiveCaption;
  8. }

  9. .tab, .tab2, .tab3 {
  10.   position: relative;
  11.   background: transparent;
  12.   border: 0;
  13.   padding: 0 12px;
  14.   opacity: 1;
  15. }

  16. .activetab {
  17.   position: relative;
  18.   background-color: #fff;
  19.   border: 0;
  20.   padding: 0 2px;
  21.   margin: 0 10px;
  22.   height: 2em;
  23. }

  24. .activetab:before,
  25. .activetab:after {
  26.   content: "";
  27.   position: absolute;
  28.   background-image: url("data:image/svg+xml;charset=utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20fill%3D%22%23fff%22%20d%3D%22M24%200C9%200%2015%2024%200%2024h25V0h-1z%22%2F%3E%3C%2Fsvg%3E");
  29.   bottom: 0;
  30.   width: 25px;
  31.   height: 24px;
  32. }
  33. .activetab:before {
  34.   left: -24px;
  35. }
  36. .activetab:after {
  37.   right: 1px;
  38.   transform: scaleX(-1);
  39.   transform-origin: right;
  40. }

  41. .tab:hover,
  42. .tab2:hover,
  43. .tab3:hover {
  44.   position: relative;
  45.   background-color: #d0e0e9;
  46.   border: 0;
  47.   padding: 0 2px;
  48.   margin: 0 10px;
  49. }

  50. .tab:hover:before,
  51. .tab:hover:after,
  52. .tab2:hover:before,
  53. .tab2:hover:after,
  54. .tab3:hover:before,
  55. .tab3:hover:after {
  56.   content: "";
  57.   position: absolute;
  58.   background-image: url("data:image/svg+xml;charset=utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20fill%3D%22%23d0e0e9%22%20d%3D%22M24%200C9%200%2015%2024%200%2024h25V0h-1z%22%2F%3E%3C%2Fsvg%3E");
  59.   bottom: 0;
  60.   width: 25px;
  61.   height: 24px;
  62. }
  63. .tab:hover:before,
  64. .tab2:hover:before,
  65. .tab3:hover:before {
  66.   left: -24px;
  67. }
  68. .tab:hover:after,
  69. .tab2:hover:after,
  70. .tab3:hover:after {
  71.   right: 1px;
  72.   transform: scaleX(-1);
  73.   transform-origin: right;
  74. }
复制代码



CSS代码源网页,有“仿Chrome标签页”和“仿FireFox标签页”两种代码,还有执行结果截图。
https://qiita.com/nocd5/items/af062f7b06d4cd3b8b18
https://tablacus.github.io/wiki/addons/usercss.html




点评

感谢分享!  发表于 4 小时前
2#
发表于 9 小时前 | 只看该作者
供参考:

  1. /* 梯形标签页基础样式 */
  2. .tab,
  3. .tab2,
  4. .tab3 {
  5.   position: relative;
  6.   display: inline-block;
  7.   background-color: transparent;
  8.   border: 0;
  9.   padding: 0 12px;
  10.   height: 2em;
  11.   line-height: 2em;
  12.   margin: 0 10px;
  13.   color: #333;
  14.   font-size: 13px;
  15.   user-select: none;
  16.   cursor: pointer;
  17.   z-index: 1;
  18. }

  19. /* 左右梯形边框 */
  20. .tab:before, .tab:after,
  21. .tab2:before, .tab2:after,
  22. .tab3:before, .tab3:after {
  23.   content: "";
  24.   position: absolute;
  25.   bottom: 0;
  26.   width: 25px;
  27.   height: 24px;
  28.   background-size: 25px 24px;
  29. }

  30. /* 左侧梯形 */
  31. .tab:before,
  32. .tab2:before,
  33. .tab3:before {
  34.   left: -24px;
  35. }

  36. /* 右侧梯形 */
  37. .tab:after,
  38. .tab2:after,
  39. .tab3:after {
  40.   right: -1px;
  41.   transform: scaleX(-1);
  42.   transform-origin: right;
  43. }

  44. /* 当前页样式 */
  45. .activetab {
  46.   background-color: #fff;
  47.   z-index: 2;
  48. }

  49. .activetab:before,
  50. .activetab:after {
  51.   background-image: url("data:image/svg+xml;charset=utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20fill%3D%22%23fff%22%20d%3D%22M24%200C9%200%2015%2024%200%2024h25V0h-1z%22%2F%3E%3C%2Fsvg%3E");
  52. }

  53. /* 鼠标悬停样式 */
  54. .tab:hover,
  55. .tab2:hover,
  56. .tab3:hover {
  57.   background-color: #d0e0e9;
  58.   z-index: 1;
  59. }

  60. .tab:hover:before, .tab:hover:after,
  61. .tab2:hover:before, .tab2:hover:after,
  62. .tab3:hover:before, .tab3:hover:after {
  63.   background-image: url("data:image/svg+xml;charset=utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20fill%3D%22%23d0e0e9%22%20d%3D%22M24%200C9%200%2015%2024%200%2024h25V0h-1z%22%2F%3E%3C%2Fsvg%3E");
  64. }

  65. /* 可选:支持不同背景颜色(通过类名) */
  66. .tab.color1 {
  67.   background-color: #f5f5f5;
  68. }
  69. .tab.color1:before, .tab.color1:after {
  70.   background-image: url("data:image/svg+xml;charset=utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20fill%3D%22%23f5f5f5%22%20d%3D%22M24%200C9%200%2015%2024%200%2024h25V0h-1z%22%2F%3E%3C%2Fsvg%3E");
  71. }

  72. .tab.color2 {
  73.   background-color: #e0f7fa;
  74. }
  75. .tab.color2:before, .tab.color2:after {
  76.   background-image: url("data:image/svg+xml;charset=utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20fill%3D%22%23e0f7fa%22%20d%3D%22M24%200C9%200%2015%2024%200%2024h25V0h-1z%22%2F%3E%3C%2Fsvg%3E");
  77. }

  78. .tab.color3 {
  79.   background-color: #fff8e1;
  80. }
  81. .tab.color3:before, .tab.color3:after {
  82.   background-image: url("data:image/svg+xml;charset=utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20fill%3D%22%23fff8e1%22%20d%3D%22M24%200C9%200%2015%2024%200%2024h25V0h-1z%22%2F%3E%3C%2Fsvg%3E");
  83. }
复制代码



回复

使用道具 举报

3#
发表于 7 小时前 | 只看该作者
来学习下
回复

使用道具 举报

4#
发表于 5 小时前 | 只看该作者
来看看
回复

使用道具 举报

5#
发表于 5 小时前 | 只看该作者
虽然看不懂但是还是要学习
回复

使用道具 举报

6#
发表于 5 小时前 | 只看该作者
进来学习一下。话说这个用AI可以轻轻松松吧
回复

使用道具 举报

7#
发表于 4 小时前 | 只看该作者
学习一下
回复

使用道具 举报

8#
发表于 3 小时前 | 只看该作者
感谢分享
回复

使用道具 举报

9#
发表于 3 小时前 | 只看该作者
AI经常搞不定。帮顶
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|捐助支持|无忧启动 ( 闽ICP备05002490号-1 )

闽公网安备 35020302032614号

GMT+8, 2025-11-19 20:48

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表