2 Star 6 Fork 1

ayhome / TiUi

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
Apache-2.0

大部分代码基于ColorUI 修改而来,ColorUI目前只针对微信小程序,本项目ColorUICss时非常纯粹的移动端CSS。 ColorUICss专注于移动端Css框架。初衷主要是要一个纯粹的移动端CSS框架,由于多用于VUE框架中, 基于VUE的框架也有很多优秀的,但往往我只需要其中一个组件,这个时候个项目就会显得很杂乱, 于是就写个纯粹的CSS。

交流QQ群:837450231

感谢ColorUI 作者,很喜欢这样的色彩搭配。

手机演示

  • 演示安装
git clone https://gitee.com/anyhome/ColorUI.git
cd ColorUI 
npm install
npm run serve

浏览地址 http://localhost:9003/colorui/

基础

  1. 布局
  2. 背景
  3. 文本
  4. 图标
  5. 按钮
  6. 标签
  7. 头像
  8. 进度条
  9. 边框阴影
  10. 加载

组件

  1. 操作条
  2. 导航栏
  3. 列表
  4. 卡片
  5. 输入框 6.复选框 7.单选框 8.开关
  6. 时间轴
  7. 聊天
  8. 轮播
  9. 模态框
  10. 步骤条

概述

ColorUICss专注于移动端Css框架,主要用于在VUE框架中弥补某些小功能、小组件的不足之处,ColorUICss只是一个纯粹的移动端CSS。 多处采用 tien- 作为命名空间而不是所有地方,是为了再不影响其他css命名冲突的前提下,一些常用的组件又不至于书写麻烦。组件的命名空间后期可能还会继续更新。

布局

固定尺寸

采用flex弹性布局,安装宽带百分比显示,例如显示20%宽度。

<div class="flex flex-wrap">
  <div class='flex-20 bg-grey margin-xs padding-sm radius'>xs(20%)</div>
  <div class='flex-40'></div>
</div>
.flex {
  display: flex;
}
.flex-wrap {
  flex-wrap: wrap;
}
.flex-20 {
  flex-basis: 20%;
}


.flex-40 {
  flex-basis: 40%;
}
.flex-50 {
  flex-basis: 50%;
}
.flex-60 {
  flex-basis: 60%;
}
.flex-80 {
  flex-basis: 80%;
}

比例布局

      <div class="flex">
        <div class='flex-sub bg-grey padding-sm margin-xs radius'>1</div>
        <div class='flex-sub bg-grey padding-sm margin-xs radius'>1</div>
      </div>
      <div class="flex margin-bottom-sm mb-sm">
        <div class='flex-sub bg-grey padding-sm margin-xs radius'>1</div>
        <div class='flex-twice bg-grey padding-sm margin-xs radius'>2</div>
      </div>
      <div class="flex  margin-bottom-sm mb-sm">
        <div class='flex-1 bg-grey padding-sm margin-xs radius'>1</div>
        <div class='flex-2 bg-grey padding-sm margin-xs radius'>2</div>
        <div class='flex-3 bg-grey padding-sm margin-xs radius'>3</div>
      </div>
.flex {
  display: flex;
}
.flex-1 {
  flex: 1;
}
.flex-2 {
  flex: 2;
}

  • 水平对齐 justify
<div class="flex justify-start">
  <div >start</div>
  <div >start</div>
</div>
<div class="flex justify-end">
  <div >end</div>
  <div >end</div>
</div>
<div class="flex justify-center">
  <div >center</div>
  <div >center</div>
</div>
<div class="flex justify-between">
  <div >between</div>
  <div >between</div>
</div>
<div class="flex justify-around">
  <div >around</div>
  <div >around</div>
</div>
.justify-start {
  justify-content: flex-start;
}
.justify-end {
  justify-content: flex-end;
}
.justify-center {
  justify-content: center;
}
.justify-between {
  justify-content: space-between;
}
.justify-around {
  justify-content: space-around;
}

  • 垂直对齐 align
<div class="flex  align-start">
  <div >ColorUi</div>
  <div >start</div>
</div>
<div class="flex  align-end">
  <div >ColorUi</div>
  <div >end</div>
</div>
<div class="flex  align-center">
  <div >ColorUi</div>
  <div >center</div>
</div>
.align-start {
align-items: flex-start;
}
.align-end {
align-items: flex-end;
}
.align-center {
align-items: center;
}
.align-stretch {
align-items: stretch;
}
.align-stretch {
align-items: stretch;
}

Grid布局

整个分10列,和我们通常使用的btcss还不太一样,比如

<div class="margin-bottom text-center grid col-4">
  <div class=" padding tien-col ">1</div>
  <div class=" padding tien-col ">2</div>
  <div class=" padding tien-col ">3</div>
  <div class=" padding tien-col ">4</div>
</div>

<div class="margin-bottom text-center grid col-5">
  <div class=" padding tien-col ">1</div>
  <div class=" padding tien-col ">2</div>
  <div class=" padding tien-col ">3</div>
  <div class=" padding tien-col ">4</div>
  <div class=" padding tien-col ">5</div>
  <div class=" padding tien-col ">6</div>
  <div class=" padding tien-col ">7</div>
  <div class=" padding tien-col ">8</div>
  <div class=" padding tien-col ">9</div>
  <div class=" padding tien-col ">10</div>
</div>

当我们要实现4列布局时,需要加外层 grid col-4,自动将内层tien-col等分。

  • 等高
<div class="grid col-4 grid-square">
</div>
.grid.grid-square {
  overflow: hidden;
}

辅助布局

  • 边距

margin-no 所有外边距为 0px

margin-5 所有外边距为5px,其他还有 margin-10、margin-15、margin-20、margin-25

margin-top-no 外上边距为 0 px,其他还有 margin-top-5、margin-top-10、margin-top-15、margin-top-20、margin-top-25

类似的还有左边距 margin-left、右边距margin-right、下边距margin-bottom。 内边距以此类推。如 padding-no、padding-5、padding-10

默认margin、padding 为 15px;

<div class="bg-white">
      <div class='padding bg-gray'>{size}的尺寸有xs/sm/df/lg/xl</div>
      <div class='flex flex-wrap padding border-top'>
        <div class="basis-df padding-bottom-xs">外边距</div>
        <div class="basis-df padding-bottom-xs">内边距</div>
        <div class="basis-df">.margin-{size}</div>
        <div class="basis-df">.padding-{size}</div>
      </div>
      <div class='flex flex-wrap padding border-top'>
        <div class="basis-df padding-bottom-xs">水平方向外边距</div>
        <div class="basis-df padding-bottom-xs">水平方向内边距</div>
        <div class="basis-df">.margin-lr-{size}</div>
        <div class="basis-df">.padding-lr-{size}</div>
      </div>
      <div class='flex flex-wrap padding border-top'>
        <div class="basis-df padding-bottom-xs">垂直方向外边距</div>
        <div class="basis-df padding-bottom-xs">垂直方向内边距</div>
        <div class="basis-df">.margin-tb-{size}</div>
        <div class="basis-df">.padding-tb-{size}</div>
      </div>
      <div class='flex flex-wrap padding border-top'>
        <div class="basis-df padding-bottom-xs">上外边距</div>
        <div class="basis-df padding-bottom-xs">上内边距</div>
        <div class="basis-df">.margin-top-{size}</div>
        <div class="basis-df">.padding-top-{size}</div>
      </div>
      <div class='flex flex-wrap padding border-top'>
        <div class="basis-df padding-bottom-xs">右外边距</div>
        <div class="basis-df padding-bottom-xs">右内边距</div>
        <div class="basis-df">.margin-right-{size}</div>
        <div class="basis-df">.padding-right-{size}</div>
      </div>
      <div class='flex flex-wrap padding border-top'>
        <div class="basis-df padding-bottom-xs">下外边距</div>
        <div class="basis-df padding-bottom-xs">下内边距</div>
        <div class="basis-df">margin-bottom-{size}</div>
        <div class="basis-df">.padding-bottom-{size}</div>
      </div>
      <div class='flex flex-wrap padding border-top'>
        <div class="basis-df padding-bottom-xs">左外边距</div>
        <div class="basis-df padding-bottom-xs">左内边距</div>
        <div class="basis-df">.margin-left-{size}</div>
        <div class="basis-df">.padding-left-{size}</div>
      </div>
    </div>
  • 圆角和浮动
//默认圆角
.radius {
  border-radius: 3px;
}
//宽度100%
.response {
  width: 100%;
}

/* -- 浮动 --  */
.cf::after, .cf::before,.clear::after, .clear::before {
  content: " ";
  display: table;
}
.cf::after,.clear::after {
  clear: both;
}
.fl {
  float: left;
}
.fr {
  float: right;
}

背景

背景以bg-前缀,例如红色背景bg-red,其他还有.bg-red、.bg-orange、.bg-yellow、.bg-olive、.bg-green、.bg-cyan、.bg-blue、.bg-purple、.bg-mauve、.bg-pink、.bg-brown、.bg-grey、.bg-gray、.bg-black、.bg-white。加上 .light 则是相对应的浅色背景

  • 渐变背景
<div>
  <div class='bg-gradual-red  shadow-blur'>
    <div class="text-lg">魅红</div>
    <div class='margin-top-sm text-Abc'>#f43f3b - #ec008c</div>
  </div>
</div>
<div>
  <div class='bg-gradual-orange  shadow-blur'>
    <div class="text-lg">鎏金</div>
    <div class='margin-top-sm text-Abc'>#ff9700 - #ed1c24</div>
  </div>
</div>
<div>
  <div class='bg-gradual-green  shadow-blur'>
    <div class="text-lg">翠柳</div>
    <div class='margin-top-sm text-Abc'>#39b54a - #8dc63f</div>
  </div>
</div>
<div>
  <div class='bg-gradual-blue  shadow-blur'>
    <div class="text-lg">靛青</div>
    <div class='margin-top-sm text-Abc'>#0081ff - #1cbbb4</div>
  </div>
</div>
<div>
  <div class='bg-gradual-purple  shadow-blur'>
    <div class="text-lg">惑紫</div>
    <div class='margin-top-sm text-Abc'>#9000ff - #5e00ff</div>
  </div>
</div>
<div class=-sm'>
  <div class='bg-gradual-pink  shadow-blur'>
    <div class="text-lg">霞彩</div>
    <div class='margin-top-sm text-Abc'>#ec008c - #6739b6</div>
  </div>
</div>

文本

  • 文字大小
.text-10 {
  font-size: 10px;
}
.text-12 {
  font-size: 12px;
}
.text-14 {
  font-size: 14px;
}
.text-16 {
  font-size: 16px;
}
.text-18 {
  font-size: 18px;
}
.text-22 {
  font-size: 22px;
}
.text-40 {
  font-size: 40px;
}
.text-60 {
  font-size: 60px;
}
//首字母大写
.text-Abc {
  text-transform: Capitalize;
}
//字母全部大写
.text-ABC {
  text-transform: Uppercase;
}
//字母全部小写
.text-abc {
  text-transform: Lowercase;
}
//字符截断
.text-cut {
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}
//粗体
.text-bold {
  font-weight: bold;
}

  • 文字对齐
//居中
.text-center {
  text-align: center;
}
//行高
.text-content {
  line-height: 1.6;
}
//左对齐
.text-left {
  text-align: left;
}
//右对齐
.text-right {
  text-align: right;
}

文字颜色

.text-red, .line-red, .lines-red {
  color: #e54d42;
}
.text-orange, .line-orange, .lines-orange {
  color: #f37b1d;
}
.text-yellow, .line-yellow, .lines-yellow {
  color: #fbbd08;
}
.text-olive, .line-olive, .lines-olive {
  color: #8dc63f;
}
.text-green, .line-green, .lines-green {
  color: #39b54a;
}
.text-cyan, .line-cyan, .lines-cyan {
  color: #1cbbb4;
}
.text-blue, .line-blue, .lines-blue {
  color: #0081ff;
}
.text-purple, .line-purple, .lines-purple {
  color: #6739b6;
}
.text-mauve, .line-mauve, .lines-mauve {
  color: #9c26b0;
}
.text-pink, .line-pink, .lines-pink {
  color: #e03997;
}
.text-brown, .line-brown, .lines-brown {
  color: #a5673f;
}
.text-grey, .line-grey, .lines-grey {
  color: #8799a3;
}
.text-gray, .line-gray, .lines-gray {
  color: #aaa;
}
.text-black, .line-black, .lines-black {
  color: #333;
}
.text-white, .line-white, .lines-white {
  color: #fff;
}

图标

图标使用阿里云 iconfont图标,为不和自己的图标冲突使用tien-前缀,例如 .tien-icon-fork

[class*="tien-icon-"] {
  font-family: "iconfont" !important;
  font-size: inherit;
  font-style: normal;
}

按钮

  • 形状、尺寸、颜色

颜色请参考背景颜色

<button class="tien-btn">默认</button>
<button class="tien-btn round">圆角</button>
<button class="tien-btn icon">
  <span class='tien-icon-emojifill'>图标</span>
</button>

<button class='tien-btn round sm'>小尺寸</button>
<button class='tien-btn round'>默认</button>
<button class='tien-btn round lg'>大尺寸</button>

镂空按钮只需要加 .line-[背景色],块状按钮加 .lg

标签

  • 形状、尺寸、颜色
<div class="tien-tag ">默认</div>
<div class="tien-tag round ">椭圆</div>
<div class="tien-tag radius">圆角</div>

<div class='tien-tag radius sm '>小尺寸</div>
<div class='tien-tag radius '>普通尺寸</div>

颜色则加 bg-[背景色]  例如 bg-red 参考背景色

  • 样式 镂空加 line-[背景色] 例如 bg-red 参考背景色。胶囊样式
<div class="tien-capsule">
  <div class='tien-tag bg-red'>
    <span class='tien-icon-likefill'></span>
  </div>
  <div class="tien-tag line-red">
    12
  </div>
</div>
<div class="tien-capsule round">
  <div class='tien-tag bg-blue '>
    <span class='tien-icon-likefill'></span>
  </div>
  <div class="tien-tag line-blue">
    23
  </div>
</div>
<div class="tien-capsule round">
  <div class='tien-tag bg-blue '>
    说明
  </div>
  <div class="tien-tag line-blue">
    123
  </div>
</div>
<div class="tien-capsule radius">
  <div class='tien-tag bg-grey '>
    <span class='tien-icon-likefill'></span>
  </div>
  <div class="tien-tag line-grey">
    23
  </div>
</div>
<div class="tien-capsule radius">
  <div class='tien-tag bg-brown sm'>
    <span class='tien-icon-likefill'></span>
  </div>
  <div class="tien-tag line-brown sm">
    23
  </div>
</div>
      

如果本项目对您有帮助请给我点动力^_^

支付宝微信

Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

简介

鲜亮的高饱和色彩,TiUi是一个Css类的UI组件库!不是一个Js框架。 展开 收起
CSS
Apache-2.0
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
CSS
1
https://gitee.com/anyhome/TiUi.git
git@gitee.com:anyhome/TiUi.git
anyhome
TiUi
TiUi
master

搜索帮助