chrome.css 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608
  1. /* CSS for UI elements (a.k.a. chrome) */
  2. @import 'variables.css';
  3. ::-webkit-scrollbar {
  4. background: var(--bg);
  5. }
  6. ::-webkit-scrollbar-thumb {
  7. background: var(--scrollbar);
  8. }
  9. html {
  10. scrollbar-color: var(--scrollbar) var(--bg);
  11. }
  12. #mdbook-searchresults a,
  13. .content a:link,
  14. a:visited,
  15. a > .hljs {
  16. color: var(--links);
  17. }
  18. /* Menu Bar */
  19. #mdbook-menu-bar,
  20. #mdbook-menu-bar-hover-placeholder {
  21. z-index: 101;
  22. margin: auto calc(0px - var(--page-padding));
  23. }
  24. #mdbook-menu-bar {
  25. position: relative;
  26. display: flex;
  27. flex-wrap: wrap;
  28. background-color: var(--bg);
  29. border-bottom-color: var(--bg);
  30. border-bottom-width: 1px;
  31. border-bottom-style: solid;
  32. }
  33. #mdbook-menu-bar.sticky,
  34. .js #mdbook-menu-bar-hover-placeholder:hover + #mdbook-menu-bar,
  35. .js #mdbook-menu-bar:hover,
  36. .js.sidebar-visible #mdbook-menu-bar {
  37. position: -webkit-sticky;
  38. position: sticky;
  39. top: 0 !important;
  40. }
  41. #mdbook-menu-bar-hover-placeholder {
  42. position: sticky;
  43. position: -webkit-sticky;
  44. top: 0;
  45. height: var(--menu-bar-height);
  46. }
  47. #mdbook-menu-bar.bordered {
  48. border-bottom-color: var(--table-border-color);
  49. }
  50. #mdbook-menu-bar i, #mdbook-menu-bar .icon-button {
  51. position: relative;
  52. padding: 0 8px;
  53. z-index: 10;
  54. line-height: var(--menu-bar-height);
  55. cursor: pointer;
  56. transition: color 0.5s;
  57. }
  58. @media only screen and (max-width: 420px) {
  59. #mdbook-menu-bar i, #mdbook-menu-bar .icon-button {
  60. padding: 0 5px;
  61. }
  62. }
  63. .icon-button {
  64. border: none;
  65. background: none;
  66. padding: 0;
  67. color: inherit;
  68. }
  69. .icon-button i {
  70. margin: 0;
  71. }
  72. .right-buttons {
  73. margin: 0 15px;
  74. }
  75. .right-buttons a {
  76. text-decoration: none;
  77. }
  78. .left-buttons {
  79. display: flex;
  80. margin: 0 5px;
  81. }
  82. .no-js .left-buttons {
  83. display: none;
  84. }
  85. .menu-title {
  86. display: inline-block;
  87. font-weight: 200;
  88. font-size: 2.4rem;
  89. line-height: var(--menu-bar-height);
  90. text-align: center;
  91. margin: 0;
  92. flex: 1;
  93. white-space: nowrap;
  94. overflow: hidden;
  95. text-overflow: ellipsis;
  96. }
  97. .js .menu-title {
  98. cursor: pointer;
  99. }
  100. .menu-bar,
  101. .menu-bar:visited,
  102. .nav-chapters,
  103. .nav-chapters:visited,
  104. .mobile-nav-chapters,
  105. .mobile-nav-chapters:visited,
  106. .menu-bar .icon-button,
  107. .menu-bar a i {
  108. color: var(--icons);
  109. }
  110. .menu-bar i:hover,
  111. .menu-bar .icon-button:hover,
  112. .nav-chapters:hover,
  113. .mobile-nav-chapters i:hover {
  114. color: var(--icons-hover);
  115. }
  116. /* Nav Icons */
  117. .nav-chapters {
  118. font-size: 2.5em;
  119. text-align: center;
  120. text-decoration: none;
  121. position: fixed;
  122. top: 0;
  123. bottom: 0;
  124. margin: 0;
  125. max-width: 150px;
  126. min-width: 90px;
  127. display: flex;
  128. justify-content: center;
  129. align-content: center;
  130. flex-direction: column;
  131. transition: color 0.5s, background-color 0.5s;
  132. }
  133. .nav-chapters:hover {
  134. text-decoration: none;
  135. background-color: var(--theme-hover);
  136. transition: background-color 0.15s, color 0.15s;
  137. }
  138. .nav-wrapper {
  139. margin-top: 50px;
  140. display: none;
  141. }
  142. .mobile-nav-chapters {
  143. font-size: 2.5em;
  144. text-align: center;
  145. text-decoration: none;
  146. width: 90px;
  147. border-radius: 5px;
  148. background-color: var(--sidebar-bg);
  149. }
  150. .previous {
  151. float: left;
  152. }
  153. .next {
  154. float: right;
  155. right: var(--page-padding);
  156. }
  157. @media only screen and (max-width: 1080px) {
  158. .nav-wide-wrapper { display: none; }
  159. .nav-wrapper { display: block; }
  160. }
  161. @media only screen and (max-width: 1380px) {
  162. .sidebar-visible .nav-wide-wrapper { display: none; }
  163. .sidebar-visible .nav-wrapper { display: block; }
  164. }
  165. /* Inline code */
  166. :not(pre) > .hljs {
  167. display: inline;
  168. padding: 0.1em 0.3em;
  169. border-radius: 3px;
  170. }
  171. :not(pre):not(a) > .hljs {
  172. color: var(--inline-code-color);
  173. overflow-x: initial;
  174. }
  175. a:hover > .hljs {
  176. text-decoration: underline;
  177. }
  178. pre {
  179. position: relative;
  180. }
  181. pre > .buttons {
  182. position: absolute;
  183. z-index: 100;
  184. right: 5px;
  185. top: 5px;
  186. color: var(--sidebar-fg);
  187. cursor: pointer;
  188. }
  189. pre > .buttons :hover {
  190. color: var(--sidebar-active);
  191. }
  192. pre > .buttons i {
  193. margin-left: 8px;
  194. }
  195. pre > .buttons button {
  196. color: inherit;
  197. background: transparent;
  198. border: none;
  199. cursor: inherit;
  200. }
  201. pre > .result {
  202. margin-top: 10px;
  203. }
  204. /* Search */
  205. #mdbook-searchresults a {
  206. text-decoration: none;
  207. }
  208. mark {
  209. border-radius: 2px;
  210. padding: 0 3px 1px 3px;
  211. margin: 0 -3px -1px -3px;
  212. background-color: var(--search-mark-bg);
  213. transition: background-color 300ms linear;
  214. cursor: pointer;
  215. }
  216. mark.fade-out {
  217. background-color: rgba(0,0,0,0) !important;
  218. cursor: auto;
  219. }
  220. .searchbar-outer {
  221. margin-left: auto;
  222. margin-right: auto;
  223. max-width: var(--content-max-width);
  224. }
  225. /* mdBook 0.5 搜索框:内层容器与加载指示器 */
  226. .search-wrapper {
  227. position: relative;
  228. }
  229. #mdbook-searchbar-outer.searching #mdbook-searchbar {
  230. padding-right: 30px;
  231. }
  232. #mdbook-searchbar-outer .spinner-wrapper {
  233. display: none;
  234. }
  235. #mdbook-searchbar-outer.searching .spinner-wrapper {
  236. display: block;
  237. }
  238. .spinner-wrapper {
  239. --spinner-margin: 2px;
  240. position: absolute;
  241. margin-block-start: calc(var(--searchbar-margin-block-start) + var(--spinner-margin));
  242. right: var(--spinner-margin);
  243. top: 0;
  244. bottom: var(--spinner-margin);
  245. padding: 6px;
  246. background-color: var(--bg);
  247. }
  248. #fa-spin {
  249. animation: rotating 2s linear infinite;
  250. display: inline-block;
  251. }
  252. @keyframes rotating {
  253. from {
  254. transform: rotate(0deg);
  255. }
  256. to {
  257. transform: rotate(360deg);
  258. }
  259. }
  260. #mdbook-searchbar {
  261. width: 100%;
  262. margin: 5px auto 0px auto;
  263. padding: 10px 16px;
  264. transition: box-shadow 300ms ease-in-out;
  265. border: 1px solid var(--searchbar-border-color);
  266. border-radius: 3px;
  267. background-color: var(--searchbar-bg);
  268. color: var(--searchbar-fg);
  269. }
  270. #mdbook-searchbar:focus,
  271. #mdbook-searchbar.active {
  272. box-shadow: 0 0 3px var(--searchbar-shadow-color);
  273. }
  274. .searchresults-header {
  275. font-weight: bold;
  276. font-size: 1em;
  277. padding: 18px 0 0 5px;
  278. color: var(--searchresults-header-fg);
  279. }
  280. .searchresults-outer {
  281. margin-left: auto;
  282. margin-right: auto;
  283. max-width: var(--content-max-width);
  284. border-bottom: 1px dashed var(--searchresults-border-color);
  285. }
  286. ul#mdbook-searchresults {
  287. list-style: none;
  288. padding-left: 20px;
  289. }
  290. ul#mdbook-searchresults li {
  291. margin: 10px 0px;
  292. padding: 2px;
  293. border-radius: 2px;
  294. }
  295. ul#mdbook-searchresults li.focus {
  296. background-color: var(--searchresults-li-bg);
  297. }
  298. ul#mdbook-searchresults span.teaser {
  299. display: block;
  300. clear: both;
  301. margin: 5px 0 0 20px;
  302. font-size: 0.8em;
  303. }
  304. ul#mdbook-searchresults span.teaser em {
  305. font-weight: bold;
  306. font-style: normal;
  307. }
  308. /* Sidebar */
  309. .sidebar {
  310. position: fixed;
  311. left: 0;
  312. top: 0;
  313. bottom: 0;
  314. width: var(--sidebar-width);
  315. font-size: 0.875em;
  316. box-sizing: border-box;
  317. -webkit-overflow-scrolling: touch;
  318. overscroll-behavior-y: contain;
  319. background-color: var(--sidebar-bg);
  320. color: var(--sidebar-fg);
  321. }
  322. .sidebar-resizing {
  323. -moz-user-select: none;
  324. -webkit-user-select: none;
  325. -ms-user-select: none;
  326. user-select: none;
  327. }
  328. .js:not(.sidebar-resizing) .sidebar {
  329. transition: transform 0.3s; /* Animation: slide away */
  330. }
  331. .sidebar code {
  332. line-height: 2em;
  333. }
  334. .sidebar .sidebar-scrollbox {
  335. overflow-y: auto;
  336. position: absolute;
  337. top: 0;
  338. bottom: 0;
  339. left: 0;
  340. right: 0;
  341. padding: 10px 10px;
  342. }
  343. /* mdBook 0.5:拖拽热区贴在侧边栏右缘外侧,配合 .sidebar-resize-indicator 显示拖拽提示 */
  344. .sidebar .sidebar-resize-handle {
  345. position: absolute;
  346. cursor: col-resize;
  347. width: 0;
  348. right: calc(var(--sidebar-resize-indicator-width) * -1);
  349. top: 0;
  350. bottom: 0;
  351. display: flex;
  352. align-items: center;
  353. }
  354. .sidebar-resize-handle .sidebar-resize-indicator {
  355. width: 100%;
  356. height: 16px;
  357. color: var(--icons);
  358. margin-inline-start: var(--sidebar-resize-indicator-space);
  359. display: flex;
  360. align-items: center;
  361. justify-content: flex-start;
  362. }
  363. .sidebar-resize-handle .sidebar-resize-indicator::before {
  364. content: "";
  365. width: 2px;
  366. height: 12px;
  367. border-left: dotted 2px currentColor;
  368. }
  369. .sidebar-resize-handle .sidebar-resize-indicator::after {
  370. content: "";
  371. width: 2px;
  372. height: 16px;
  373. border-left: dotted 2px currentColor;
  374. }
  375. .js .sidebar .sidebar-resize-handle {
  376. cursor: col-resize;
  377. width: calc(var(--sidebar-resize-indicator-width) - var(--sidebar-resize-indicator-space));
  378. }
  379. .sidebar-hidden .sidebar {
  380. transform: translateX(calc(0px - var(--sidebar-width)));
  381. }
  382. .sidebar::-webkit-scrollbar {
  383. background: var(--sidebar-bg);
  384. }
  385. .sidebar::-webkit-scrollbar-thumb {
  386. background: var(--scrollbar);
  387. }
  388. .sidebar-visible .page-wrapper {
  389. transform: translateX(var(--sidebar-width));
  390. }
  391. @media only screen and (min-width: 620px) {
  392. .sidebar-visible .page-wrapper {
  393. transform: none;
  394. margin-left: var(--sidebar-width);
  395. }
  396. }
  397. .chapter {
  398. list-style: none outside none;
  399. padding-left: 0;
  400. line-height: 2.2em;
  401. }
  402. .chapter ol {
  403. width: 100%;
  404. }
  405. .chapter li {
  406. color: var(--sidebar-non-existant);
  407. }
  408. /* mdBook 0.5:链接与折叠箭头由一个 span 包裹,靠它做 flex 布局 */
  409. .chapter li > .chapter-link-wrapper {
  410. display: flex;
  411. }
  412. .chapter li a {
  413. display: block;
  414. padding: 0;
  415. text-decoration: none;
  416. color: var(--sidebar-fg);
  417. }
  418. .chapter li a:hover {
  419. color: var(--sidebar-active);
  420. }
  421. .chapter li a.active {
  422. color: var(--sidebar-active);
  423. }
  424. /* mdBook 0.5:折叠箭头在 .chapter-link-wrapper 内,不是 li 的直接子 */
  425. .chapter .chapter-link-wrapper > a.chapter-fold-toggle {
  426. cursor: pointer;
  427. display: block;
  428. margin-left: auto;
  429. padding: 0 10px;
  430. user-select: none;
  431. opacity: 0.68;
  432. }
  433. .chapter .chapter-link-wrapper > a.chapter-fold-toggle div {
  434. transition: transform 0.5s;
  435. }
  436. /* collapse the section(0.5:子目录 ol 与折叠按钮同在一个 li 内) */
  437. .chapter li:not(.expanded) > ol.section {
  438. display: none;
  439. }
  440. .chapter li.chapter-item {
  441. line-height: 1.5em;
  442. margin-top: 0.6em;
  443. }
  444. .chapter li.expanded > .chapter-link-wrapper > a.chapter-fold-toggle div {
  445. transform: rotate(90deg);
  446. }
  447. .spacer {
  448. width: 100%;
  449. height: 3px;
  450. margin: 5px 0px;
  451. }
  452. .chapter .spacer {
  453. background-color: var(--sidebar-spacer);
  454. }
  455. @media (-moz-touch-enabled: 1), (pointer: coarse) {
  456. .chapter li a { padding: 5px 0; }
  457. .spacer { margin: 10px 0; }
  458. }
  459. .section {
  460. list-style: none outside none;
  461. padding-left: 20px;
  462. line-height: 1.9em;
  463. }
  464. /* Theme Menu Popup */
  465. .theme-popup {
  466. position: absolute;
  467. left: 10px;
  468. top: var(--menu-bar-height);
  469. z-index: 1000;
  470. border-radius: 4px;
  471. font-size: 0.7em;
  472. color: var(--fg);
  473. background: var(--theme-popup-bg);
  474. border: 1px solid var(--theme-popup-border);
  475. margin: 0;
  476. padding: 0;
  477. list-style: none;
  478. display: none;
  479. }
  480. .theme-popup .default {
  481. color: var(--icons);
  482. }
  483. .theme-popup .theme {
  484. width: 100%;
  485. border: 0;
  486. margin: 0;
  487. padding: 2px 10px;
  488. line-height: 25px;
  489. white-space: nowrap;
  490. text-align: left;
  491. cursor: pointer;
  492. color: inherit;
  493. background: inherit;
  494. font-size: inherit;
  495. }
  496. .theme-popup .theme:hover {
  497. background-color: var(--theme-hover);
  498. }
  499. .theme-popup .theme:hover:first-child,
  500. .theme-popup .theme:hover:last-child {
  501. border-top-left-radius: inherit;
  502. border-top-right-radius: inherit;
  503. }
  504. /* mdBook 0.5:当前主题在菜单里打勾 */
  505. .theme-selected::before {
  506. display: inline-block;
  507. content: "✓";
  508. margin-inline-start: -14px;
  509. width: 14px;
  510. }
  511. /* mdBook 0.5:键盘快捷键帮助弹层(按 ? 触发) */
  512. #mdbook-help-container {
  513. position: fixed;
  514. top: 0;
  515. left: 0;
  516. right: 0;
  517. bottom: 0;
  518. display: none;
  519. align-items: center;
  520. justify-content: center;
  521. z-index: 1000;
  522. background: var(--overlay-bg);
  523. }
  524. #mdbook-help-popup {
  525. box-shadow: 0 4px 24px rgba(0,0,0,0.15);
  526. min-width: 300px;
  527. max-width: 500px;
  528. width: 100%;
  529. box-sizing: border-box;
  530. display: flex;
  531. flex-direction: column;
  532. align-items: center;
  533. background-color: var(--bg);
  534. color: var(--fg);
  535. border-width: 1px;
  536. border-color: var(--theme-popup-border);
  537. border-style: solid;
  538. border-radius: 8px;
  539. padding: 10px;
  540. }
  541. .mdbook-help-title {
  542. text-align: center;
  543. margin: 10px;
  544. }