uniapp - sunui.css
时间:2020-01-08
本文章向大家介绍uniapp - sunui.css,主要包括uniapp - sunui.css使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。
sunui.css(v1.0.0) 一般来说,不会影响到你的项目样式(但还是建议先导入).
在设计sunui.css,考虑到了这部分问题;sunui.css可以分为以下
sunui-reset.css
sunui-components.css
sunui-basic.css
reset.css一般用来初始化,basic.css一般内置些样式,components.css这部分会影响到组件但被我替换掉了,我觉得只要简洁实用就行;没必要别人用你一个组件你就把css给人家导入了。
/*
sunUI(轻便、简洁、易扩展)
Q. 为什么不把具体的样式写进sunUI.css
A. 为了方便轻便、简介性、扩展性方便大家的“使用”,sunUI.css仅提供基础样式
Q. 为什么仅仅提供了示例,而非完整的样式?
A. 方便大家学习并了解其中的原理; 授人以鱼不如授人以渔
Q. 我能为sunUI提供一些组件和样式以及需求吗?
A. 非常感谢大家能提供样式、组件、模板和bug以及需求,如果提供了版本迭代时就会贴上对应的署名
Tips:
1.如果样式被flex布局影响了,直接修改display属性为block或其它就可以避免所有布局影响.
2.公共样式最好不要写上最大权限值important
3.关于脱离文档流(position:absolute,fixed...)和文档流(font-size、color)要分清顺序(可以减少dom操作影响)
4.z-index仅当前样式有position属性才生效,z-index:9999
5.使用别套UI要参考ui前缀,譬如:sunui-xx
6.样式最好分离管理(最后利用一些工具,例如webpack合成)
7.button、view、navigator支持hover-class;其余标签则不支持
8.uniapp 特别是最外层page最好不要使用外边距(margin),最好使用内边距(padding)
9.元素透明:transparent
10.currentColor表示“当前的标签所继承的文字颜色”
*/
view {
font-size: 28rpx;
line-height: 2em;
font-family: -apple-system-font, Helvetica Neue, sans-serif;
/* 会对样式造成非常大的影响 */
box-sizing: border-box;
-webkit-overflow-scrolling: touch;
}
button,
button:after,
button:before {
border-radius: 0;
border: 0;
position: relative;
}
image,
video,
progress,
textarea,
input {
width: 100%;
}
/* 隐藏滚动条 */
::-webkit-scrollbar {
display: none !important;
}
/* button禁用样式 */
button[disabled] {
color: #fff !important;
background: #cdcdcd !important;
border: transparent !important;
cursor: not-allowed !important;
}
/* 关于ios安全区域(iphone x,iphone xs ,iphone xs max, iphone xr),详情见:https://blog.csdn.net/qq_42354773/article/details/81018615、https://blog.csdn.net/qq_43071910/article/details/85294434 */
.iphonex {
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom);
}
.sunui {
padding: 4%;
}
/* 一般用于头像和文字描述隔开 */
.sunui-m-l {
margin-left: 6rpx;
}
.sunui-margin5 {
margin: 5rpx;
}
.sunui-margin10 {
margin: 10rpx;
}
.sunui-margin15 {
margin: 15rpx;
}
.sunui-margin20 {
margin: 20rpx;
}
.sunui-padding5 {
padding: 5rpx;
}
.sunui-padding10 {
padding: 10rpx;
}
.sunui-padding15 {
padding: 15rpx;
}
.sunui-padding20 {
padding: 20rpx;
}
.sunui-text-blue {
color: #038dd8;
}
.sunui-text-green {
color: #038dd8;
}
.sunui-text-yellow {
color: #038dd8;
}
.sunui-text-orange {
color: #038dd8;
}
.sunui-bg-blue {
background-color: #038dd8;
}
.sunui-bg-green {
background-color: #009b4d;
}
.sunui-bg-yellow {
background-color: #fdd100;
}
.sunui-bg-orange {
background-color: #f18518;
}
.sunui-lgbg-green {
background-image: linear-gradient(45deg, #39B55A 0%, #8DC63E 80%);
}
.sunui-show {
display: block !important;
}
.sunui-hidden {
display: none !important;
}
.sunui-left {
text-align: left;
}
.sunui-right {
text-align: right;
}
.sunui-center {
text-align: center;
}
.sunui-white {
color: #fff;
}
.sunui-red {
color: #e54d42;
}
.sunui-orange {
color: #f37b1d;
}
.sunui-w100 {
width: 100%;
}
.sunui-w50 {
width: 50%;
}
.sunui-w33 {
width: calc(100% / 3);
}
.sunui-w20 {
width: 20%;
}
.sunui-redius-small {
border-radius: 20rpx !important;
}
.sunui-redius-middle {
border-radius: 30rpx !important;
}
.sunui-redius-big {
border-radius: 100rpx !important;
}
.sunui-f {
display: flex;
}
.sunui-f-wrap {
display: flex;
flex-wrap: wrap;
}
.sunui-f-flow {
display: flex;
flex-flow: row nowrap;
}
.sunui-f-start {
display: flex;
justify-content: flex-start;
}
.sunui-f-center {
display: flex;
justify-content: center;
}
.sunui-f-end {
display: flex;
justify-content: flex-end;
}
.sunui-f-s-a {
display: flex;
align-items: center;
justify-content: space-around;
}
.sunui-f-s-b {
display: flex;
align-items: center;
justify-content: space-between;
}
.sunui-f-align-c {
display: flex;
align-items: center;
}
.sunui-f-align-s {
display: flex;
align-items: flex-start;
}
.sunui-f-align-e {
display: flex;
align-items: flex-end;
}
.sunui-f-algin-b {
display: flex;
align-items: baseline;
}
.sunui-f-align-stretch {
display: flex;
align-items: stretch;
}
.sunui-f-align-center {
display: flex;
align-items: center;
}
.sunui-border-t {
border-top: 1rpx solid #eee;
}
.sunui-border-l {
border-left: 1rpx solid #eee;
}
.sunui-border-b {
border-bottom: 1rpx solid #eee;
}
.sunui-border-r {
border-right: 1rpx solid #eee;
}
.sunui-text-weight {
font-weight: bold;
}
/* cell单元格 */
.sunui-cell {
position: relative;
display: flex;
width: 100%;
padding: 10px 15px;
font-size: 1em;
color: #333;
background-color: #fff;
box-sizing: border-box;
}
.sunui-cell-label {
margin-top: 3px;
font-size: 12px;
line-height: 18px;
color: #999;
}
.sunui-cell:after {
content: ' ';
position: absolute;
bottom: 0;
width: 96%;
border-bottom: 1px solid #eee;
}
.sunui-cell-title {
flex: 1;
}
.sunui-cell-value {
display: flex;
justify-content: flex-end;
align-items: center;
overflow: hidden;
color: #999;
text-align: right;
vertical-align: middle;
}
/* 标题 */
.sunui-title {
margin: 0;
margin-bottom: 4%;
font-weight: 400;
font-size: 14px;
color: rgba(69, 90, 100, 0.6);
padding: 20px 15px 15px;
border-bottom: 1rpx solid #eee;
}
/* tag标签 */
.sunui-tag {
color: #fff;
font-size: 10px;
padding: .2em .5em;
line-height: normal;
border-radius: .2em;
display: inline-block;
}
.sunui-tag+.sunui-transpaint {
background-color: transparent;
}
/* text文字 */
.sunui-text {
width: 25%;
line-height: 50px;
border-bottom: 1px solid #F8F8F8;
border-right: 1px solid #F8F8F8;
}
.sunui-text-ellipsis {
width: 160rpx;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
/* bg背景 */
.sunui-bg {
width: 20%;
line-height: 50px;
margin: 10px;
text-align: center;
border-radius: 5px;
box-shadow: 0 0 10px 15px inherit;
}
.sunui-box-shadow {
box-shadow: 0px 0px 8px #D5D6D8;
}
.sunui-shadow {
position: relative;
}
.sunui-shadow:before {
content: "";
display: block;
width: 100%;
height: 100%;
background: inherit;
filter: blur(3px);
position: absolute;
top: 4px;
left: 4px;
z-index: -1;
opacity: 0.38;
transform-origin: 0 0;
border-radius: inherit;
transform: scale(1, 1);
}
/* hover-class*/
.sunui-hover {
opacity: .9;
position: relative;
}
.sunui-hover:after {
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
background-color: rgba(0, 0, 0, .01);
}
.btn.btn-hover {
transform: translate(1rpx, 1rpx);
}
/* 头像大小 */
.head-avatar-small {
width: 100rpx;
height: 100rpx;
border-radius: 50%;
}
.head-avatar-middle {
width: 160rpx;
height: 160rpx;
border-radius: 50%;
}
.head-avatar-big {
width: 220rpx;
height: 220rpx;
border-radius: 50%;
}
原文地址:https://www.cnblogs.com/cisum/p/12166455.html
- Mac上提升python运算速度-PyPy初体验
- python处理json数据(复杂的json转化成嵌套字典并处理)
- Pointer-network理论及tensorflow实战
- python3 log文件处理获取某天需要的数据
- 实战深度强化学习DQN-理论和实践
- Python 工匠:编写条件分支代码的技巧
- python3 下 Zabbix监控调用graph.get并且下载监控图
- 用R语言复盘美国总统大选结果~
- 最新Apache Spark平台的NLP库,助你轻松搞定自然语言处理任务
- 使用Seq2Seq+attention实现简单的Chatbot
- R语言可视化——用ggplot构造期待已久的雷达图
- 【实战】最新Deep Learning with Keras图书加代码,教你从零开发一个复杂深度学习模型(附下载)
- 基于zabbix 自动抓取每天监控数据!/usr/local/python/bin/python3.5
- 大过年的,一起来用Seq2Seq来作对联吧!
- HTML 教程
- HTML 简介
- html div 标签介绍
- html span 标签介绍
- html a 超链接标签
- HTML Br换行标签介绍
- HTML P段落标签介绍
- HTML br与p标签区别
- Html H 标题标签
- html px em pt长度单位
- HTML form 标签
- HTML radio 单选框
- HTML B 加粗标签
- HTML strong加粗粗体标签
- HTML em 强调标签
- HTML i 斜体标签
- HTML u下划线标签
- HTML s 删除线标签
- Html img 图片标签
- Html上标注sup与下标注sub标签
- HTML nobr 禁止换行标签
- HTML hr 水平线标签
- HTML label 标签
- HTML input 标签
- HTML textarea 标签
- HTML select下拉列表标签
- HTML checkbox 多选框
- HTML font color 标签
- HTML iframe 框架标签
- HTML Table 表格
- HTML dl dt dd 标签
- HTML ol li有序列表标签
- HTML ul li 无序列表标签
- HTML 注释
- CSS 教程
- CSS 简介
- CSS 语法
- CSS Id 和 Class选择器
- CSS 样式的创建
- CSS background 背景介绍
- CSS 文本样式
- CSS font 字体
- CSS A 链接
- CSS ul ol列表样式
- CSS TABLE 样式
- CSS 框模型
- CSS border 边框
- CSS Outlines 轮廓
- CSS 外边距 Margin
- CSS Padding 内边距
- CSS 分组和嵌套选择器
- CSS 尺寸 (Dimension)
- CSS Display 属性
- CSS Position 定位
- CSS Float 浮动
- CSS 水平对齐(Horizontal Align)
- CSS 组合选择符
- CSS 伪类
- CSS 伪元素
- CSS 导航栏
- CSS 下拉菜单
- CSS 图片廊
- CSS 图像透明/不透明
- CSS sprite 图像拼合技术
- CSS 媒体类型
- CSS 属性选择器
- CSS 实例