_code.scss 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. // Inline and block code styles
  2. code,
  3. kbd,
  4. pre,
  5. samp {
  6. font-family: $font-family-monospace;
  7. }
  8. // Inline code
  9. code {
  10. padding: $code-padding-y $code-padding-x;
  11. font-size: $code-font-size;
  12. color: $code-color;
  13. background-color: $code-bg;
  14. @include border-radius($border-radius);
  15. // Streamline the style when inside anchors to avoid broken underline and more
  16. a > & {
  17. padding: 0;
  18. color: inherit;
  19. background-color: inherit;
  20. }
  21. }
  22. // User input typically entered via keyboard
  23. kbd {
  24. padding: $code-padding-y $code-padding-x;
  25. font-size: $code-font-size;
  26. color: $kbd-color;
  27. background-color: $kbd-bg;
  28. @include border-radius($border-radius-sm);
  29. @include box-shadow($kbd-box-shadow);
  30. kbd {
  31. padding: 0;
  32. font-size: 100%;
  33. font-weight: $nested-kbd-font-weight;
  34. @include box-shadow(none);
  35. }
  36. }
  37. // Blocks of code
  38. pre {
  39. display: block;
  40. margin-top: 0;
  41. margin-bottom: 1rem;
  42. font-size: $code-font-size;
  43. color: $pre-color;
  44. // Account for some code outputs that place code tags in pre tags
  45. code {
  46. padding: 0;
  47. font-size: inherit;
  48. color: inherit;
  49. background-color: transparent;
  50. border-radius: 0;
  51. }
  52. }
  53. // Enable scrollable blocks of code
  54. .pre-scrollable {
  55. max-height: $pre-scrollable-max-height;
  56. overflow-y: scroll;
  57. }