_utility.scss 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334
  1. @charset "utf-8";
  2. /**
  3. * @author: liveme
  4. * @update: 2015-06-03 17:29:12
  5. * @copyright: 基于 Neat.css | MIT License
  6. */
  7. /* ==========================================================================
  8. 基础工具@Basis
  9. ========================================================================== */
  10. /**
  11. * 闭合浮动
  12. */
  13. .u-clearfix {
  14. @include clearfix;
  15. }
  16. /* ==========================================================================
  17. 字体排版工具@Type
  18. ========================================================================== */
  19. /**
  20. * 文字溢出显示省略号,需指定宽度
  21. */
  22. .u-ellipsis {
  23. display: block;
  24. @include ellipsis;
  25. }
  26. /* 强制不换行 */
  27. .u-nowrap {
  28. @include nowrap;
  29. }
  30. /* 连续字符换行 */
  31. .u-wrap {
  32. @include break;
  33. }
  34. /**
  35. * 禁用中文输入法
  36. * 1. 默认关闭输入法,但用户还可以手动开启,Firefox Linux 版不支持。
  37. * @note: 仅 IE 5+,Firefox 3+ 支持
  38. * @doc: https://developer.mozilla.org/en-US/docs/Web/CSS/ime-mode
  39. */
  40. .u-imeInactive {
  41. ime-mode: inactive !important; /* 1 */
  42. }
  43. /*
  44. * OS X 字体平滑
  45. * 1. Fiefox 25 开始支持「-moz-osx-font-smoothing:auto(默认)|grayscale」
  46. */
  47. .u-antialiased {
  48. -webkit-font-smoothing: antialiased;
  49. -moz-osx-font-smoothing: grayscale; /* 1 */
  50. }
  51. /*
  52. * 雅黑
  53. * 对于西文,OS X使用"Helvetica Neue", Helvetica; Windows使用Tahoma, Arial;
  54. * 字体策略参考:http://zenozeng.github.io/fonts.css/
  55. */
  56. .u-heiti,
  57. %u-heiti {
  58. font-family: "Helvetica Neue", Helvetica, Tahoma, Arial, "Liberation Sans", "Hiragino Sans GB", "Source Han Sans CN", "Source Han Sans SC", "Microsoft YaHei", "Wenquanyi Micro Hei", "WenQuanYi Zen Hei", "ST Heiti", SimHei, "WenQuanYi Zen Hei Sharp", sans-serif;
  59. }
  60. /*
  61. * 宋体
  62. * 对于西文,OS X使用"Helvetica Neue", Helvetica; Windows使用Tahoma, Arial。使用宋体时字号不宜超过14px,并且不宜设置字体平滑
  63. * 字体策略参考:http://zenozeng.github.io/fonts.css/
  64. */
  65. .u-songti,
  66. %u-songti {
  67. font-family: "Helvetica Neue", Helvetica, Tahoma, Arial, SimSun, "TW\-Sung", "WenQuanYi Bitmap Song", "AR PL UMing CN", "AR PL UMing HK", "AR PL UMing TW", "AR PL UMing TW MBE", serif;
  68. }
  69. /* 等宽字体 */
  70. .u-monospace,
  71. %u-songti {
  72. font-family: Monaco, Menlo, Consolas, "Courier New", monospace;
  73. }
  74. /* 文本颜色 */
  75. .u-txtPrimary {
  76. color: #0097d6;
  77. }
  78. .u-txtSuccess {
  79. color: #7cae23;
  80. }
  81. .u-txtInfo {
  82. color: #9ac9e3;
  83. }
  84. .u-txtWarning {
  85. color: #f96;
  86. }
  87. .u-txtDanger {
  88. color: #e4393c;
  89. }
  90. .u-txtGray {
  91. color: #999;
  92. }
  93. /* 背景颜色 */
  94. .u-bgPrimary {
  95. color: $primary-text-color;
  96. background-color: $primary-color;
  97. }
  98. .u-bgSuccess {
  99. color: $success-text-color;
  100. background-color: $success-color;
  101. }
  102. .u-bgInfo {
  103. color: $info-text-color;
  104. background-color: $info-color;
  105. }
  106. .u-bgWarning {
  107. color: $warning-text-color;
  108. background-color: $warning-color;
  109. }
  110. .u-bgDanger {
  111. color: $danger-text-color;
  112. background-color: $danger-color;
  113. }
  114. /* ==========================================================================
  115. 布局工具@Layout
  116. ========================================================================== */
  117. /* 浮动 */
  118. .u-left {
  119. @include float(left, true);
  120. }
  121. .u-right {
  122. @include float(right, true);
  123. }
  124. /* 隐藏 */
  125. .u-hide {
  126. display: none;
  127. }
  128. /*
  129. * display: inline-block;
  130. * 1. 针对所有现代浏览器
  131. * 2. fixed IE6/7 1px
  132. * 3. fixed Safari 5- 等不支持 font-size: 0 的浏览器
  133. * 4. 字号大小
  134. * @ Usage: 结构如下
  135. <div class="u-inbGroup">
  136. <span class="u-inb">xxx</span>
  137. <span class="u-inb">xxx</span>
  138. <span class="u-inb">xxx</span>
  139. <span class="u-inb">xxx</span>
  140. </div>
  141. */
  142. .u-inbGroup {
  143. font-size: 0; /* 1 */
  144. *word-spacing: -1px; /* 2 */
  145. }
  146. @media (-webkit-min-device-pixel-ratio:0) {
  147. .u-inbGroup {
  148. letter-spacing: -5px; /* 3 */
  149. }
  150. }
  151. .u-inb {
  152. @include inline-block(top, true);
  153. font-size: 12px; /* 4 */
  154. letter-spacing: normal;
  155. word-spacing: normal;
  156. line-height: initial;
  157. }
  158. /*
  159. * 未知高度垂直居中组件,支持图片,单行或多行文字,以及图文混排
  160. * 1. 继承父级高度
  161. * 2. 保证连续字符也能居中
  162. * 3. 防止设置边距导致居中失效
  163. * 4. 保证连续字符换行
  164. * 5. 保证文字垂直居中
  165. * 6. 使用空标签生成一个高度100%的参照元素
  166. */
  167. .u-center {
  168. height: 100%; /* 1 */
  169. text-align: center;
  170. font-size: 0;
  171. *word-spacing: -1px;
  172. }
  173. @media (-webkit-min-device-pixel-ratio:0) {
  174. .u-center {
  175. letter-spacing: -5px;
  176. }
  177. }
  178. .u-center__inner {
  179. width: 100%; /* 2 */
  180. padding: 0 !important; /* 3 */
  181. margin: 0 !important;
  182. font-size: 12px;
  183. letter-spacing: normal;
  184. word-spacing: normal;
  185. white-space: normal; /* 4 */
  186. word-wrap: break-word;
  187. }
  188. .u-center__inner,
  189. .u-center__hack {
  190. display: inline-block;
  191. *display: inline;
  192. *zoom: 1;
  193. vertical-align: middle; /* 5 */
  194. }
  195. /* 6 */
  196. .u-center__hack {
  197. width: 0;
  198. height: 100%;
  199. }
  200. /*
  201. *@ Name: 自适应两端对齐组件
  202. *@ Update: 2014-12-05 11:02:32
  203. *@ Rely: 依赖 inline-block 解决方案
  204. *@ Usage: 结构如下
  205. <div class="util-justify u-inbGroup">
  206. <span class="u-inb">欢</span>
  207. <span class="u-inb">聚</span>
  208. <span class="u-inb">时</span>
  209. <span class="u-inb">代</span>
  210. </div>
  211. 1. for IE 6-7
  212. 2. IE 6-7 触发 hasLayout 使一行也能两端对齐
  213. 3. IE 8+
  214. 4. 子元素取消两端对齐
  215. 5. 不支持 text-align-last 的浏览器用伪元素模拟
  216. 6. margin-left:100% 仅 WebKit 支持
  217. */
  218. .u-justify {
  219. text-align: justify;
  220. text-justify: inter-ideograph; /* 1 */
  221. *zoom: 1; /* 2 */
  222. line-height: initial;
  223. -moz-text-align-last: justify;
  224. -webkit-text-align-last: justify;
  225. text-align-last: justify; /* 3 */
  226. /* 4 */
  227. .u-inb__item {
  228. -moz-text-align-last: auto;
  229. -webkit-text-align-last: auto;
  230. text-align-last: auto;
  231. text-justify: auto;
  232. text-align: left;
  233. }
  234. /* 5 */
  235. &:after {
  236. content: "";
  237. display: inline-block;
  238. width: 100%; /* 6 */
  239. }
  240. }
  241. /**
  242. * CSS三角形
  243. */
  244. $border-width: 6px;
  245. $arrow-color: #666;
  246. .u-arrow {
  247. width: 0;
  248. height: 0;
  249. line-height: 0;
  250. overflow: hidden;
  251. @include inline-block(-2px, true);
  252. border: 0 dashed transparent;
  253. border-width: $border-width;
  254. font-size: 0;
  255. &.ext-top {
  256. border-bottom-style: solid;
  257. border-bottom-color: $arrow-color;
  258. }
  259. &.ext-bottom {
  260. border-top-style: solid;
  261. border-top-color: $arrow-color;
  262. }
  263. &.ext-left {
  264. border-right-style: solid;
  265. border-right-color: $arrow-color;
  266. }
  267. &.ext-right {
  268. border-left-style: solid;
  269. border-left-color: $arrow-color;
  270. }
  271. /* ◤左上角 */
  272. &.ext-leftTop {
  273. border-top-style: solid;
  274. border-top-color: $arrow-color;
  275. border-left-width: 0 !important;
  276. }
  277. /* ◥右上角 */
  278. &.ext-rightTop {
  279. border-top-style: solid;
  280. border-top-color: $arrow-color;
  281. border-right-width: 0 !important;
  282. }
  283. /* ◣左下角 */
  284. &.ext-leftBtm {
  285. border-bottom-style: solid;
  286. border-bottom-color: $arrow-color;
  287. border-left-width: 0 !important;
  288. }
  289. /* ◢右下角 */
  290. &.ext-rightBtm {
  291. border-bottom-style: solid;
  292. border-bottom-color: $arrow-color;
  293. border-right-width: 0 !important;
  294. }
  295. }