style 模块

style 模块主要包含就是样式部分,包含内置 icon、基础的 reset 以及基础通用样式。

内置 icon

图标是利用 @font-face">font-face 规则自定义字体 "cube-icon" 实现的。

使用的时候只需要加入对应的类名即可,例如 alert 图标,可以这样用:<i class="cubeic-alert"></i>

内置 icon 有 65 个:

style - 图1
style - 图2

reset.css

源码地址:reset,使用的就是 Eric Meyer's Reset CSS。

  1. /**
  2. * Eric Meyer's Reset CSS v2.0 (http://meyerweb.com/eric/tools/css/reset/)
  3. * http://cssreset.com
  4. */
  5. html, body, div, span, applet, object, iframe,
  6. h1, h2, h3, h4, h5, h6, p, blockquote, pre,
  7. a, abbr, acronym, address, big, cite, code,
  8. del, dfn, em, img, ins, kbd, q, s, samp,
  9. small, strike, strong, sub, sup, tt, var,
  10. b, u, i, center,
  11. dl, dt, dd, ol, ul, li,
  12. fieldset, form, label, legend,
  13. table, caption, tbody, tfoot, thead, tr, th, td,
  14. article, aside, canvas, details, embed,
  15. figure, figcaption, footer, header,
  16. menu, nav, output, ruby, section, summary,
  17. time, mark, audio, video, input
  18. margin: 0
  19. padding: 0
  20. border: 0
  21. font-size: 100%
  22. font-weight: normal
  23. vertical-align: baseline
  24. /* HTML5 display-role reset for older browsers */
  25. article, aside, details, figcaption, figure,
  26. footer, header, menu, nav, section
  27. display: block
  28. body
  29. line-height: 1
  30. blockquote, q
  31. quotes: none
  32. blockquote:before, blockquote:after,
  33. q:before, q:after
  34. content: none
  35. table
  36. border-collapse: collapse
  37. border-spacing: 0
  38. /* custom */
  39. a
  40. color: #7e8c8d
  41. -webkit-backface-visibility: hidden
  42. text-decoration: none
  43. li
  44. list-style: none
  45. body
  46. -webkit-text-size-adjust: none
  47. -webkit-tap-highlight-color: rgba(0, 0, 0, 0)

base.css

源码地址:base,主要包含的就是 html, body 元素的 font-family, line-height 等的设定,修正浮动影响的 .clear-fix,以及上下左右四个边框的绝对 1px 边框的 class:.border-top-1px, .border-right-1px, .border-bottom-1px, .border-left-1px

  1. @require "./variable.styl"
  2. body, html
  3. line-height: 1
  4. font-family: 'PingFang SC', 'STHeitiSC-Light', 'Helvetica-Light', arial, sans-serif, 'Droid Sans Fallback'
  5. user-select: none
  6. -webkit-tap-highlight-color: transparent
  7. .clear-fix
  8. &::after
  9. content: ""
  10. display: table
  11. clear: both
  12. .border-top-1px, .border-right-1px, .border-bottom-1px, .border-left-1px
  13. position: relative
  14. &::before, &::after
  15. content: ""
  16. display: block
  17. position: absolute
  18. transform-origin: 0 0
  19. .border-top-1px
  20. &::before
  21. border-top: 1px solid - color-row-line
  22. left: 0
  23. top: 0
  24. width: 100%
  25. transform-origin: 0 top
  26. .border-right-1px
  27. &::after
  28. border-right: 1px solid - color-col-line
  29. top: 0
  30. right: 0
  31. height: 100%
  32. transform-origin: right 0
  33. .border-bottom-1px
  34. &::after
  35. border-bottom: 1px solid - color-row-line
  36. left: 0
  37. bottom: 0
  38. width: 100%
  39. transform-origin: 0 bottom
  40. .border-left-1px
  41. &::before
  42. border-left: 1px solid - color-col-line
  43. top: 0
  44. left: 0
  45. height: 100%
  46. transform-origin: left 0
  47. @media (min-resolution: 2dppx)
  48. .border-top-1px
  49. &::before
  50. width: 200%
  51. transform: scale(.5) translateZ(0)
  52. .border-right-1px
  53. &::after
  54. height: 200%
  55. transform: scale(.5) translateZ(0)
  56. .border-bottom-1px
  57. &::after
  58. width: 200%
  59. transform: scale(.5) translateZ(0)
  60. .border-left-1px
  61. &::before
  62. height: 200%
  63. transform: scale(.5) translateZ(0)
  64. @media (min-resolution: 3dppx)
  65. .border-top-1px
  66. &::before
  67. width: 300%
  68. transform: scale(.333) translateZ(0)
  69. .border-right-1px
  70. &::after
  71. height: 300%
  72. transform: scale(.333) translateZ(0)
  73. .border-bottom-1px
  74. &::after
  75. width: 300%
  76. transform: scale(.333) translateZ(0)
  77. .border-left-1px
  78. &::before
  79. height: 300%
  80. transform: scale(.333) translateZ(0)

原文:

https://didi.github.io/cube-ui/#/zh-CN/docs/style