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给人家导入了。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 | /* sunUI(轻便、简洁、易扩展) - v1.0(email:1940694428@qq.com) 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 : 28 rpx; 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 : 6 rpx; } .sunui-margin 5 { margin : 5 rpx; } .sunui-margin 10 { margin : 10 rpx; } .sunui-margin 15 { margin : 15 rpx; } .sunui-margin 20 { margin : 20 rpx; } .sunui-padding 5 { padding : 5 rpx; } .sunui-padding 10 { padding : 10 rpx; } .sunui-padding 15 { padding : 15 rpx; } .sunui-padding 20 { padding : 20 rpx; } .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( 45 deg, #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-w 100 { width : 100% ; } .sunui-w 50 { width : 50% ; } .sunui-w 33 { width : calc( 100% / 3 ); } .sunui-w 20 { width : 20% ; } .sunui-redius- small { border-radius: 20 rpx !important ; } .sunui-redius- middle { border-radius: 30 rpx !important ; } .sunui-redius-big { border-radius: 100 rpx !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 : 1 rpx solid #eee ; } .sunui-border-l { border-left : 1 rpx solid #eee ; } .sunui-border-b { border-bottom : 1 rpx solid #eee ; } .sunui-border-r { border-right : 1 rpx 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 : 1 rpx 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 : 160 rpx; 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( 1 rpx, 1 rpx); } /* 头像大小 */ .head-avatar- small { width : 100 rpx; height : 100 rpx; border-radius: 50% ; } .head-avatar- middle { width : 160 rpx; height : 160 rpx; border-radius: 50% ; } .head-avatar-big { width : 220 rpx; height : 220 rpx; border-radius: 50% ; } |
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· AI与.NET技术实操系列:基于图像分类模型对图像进行分类
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· 25岁的心里话
· ollama系列01:轻松3步本地部署deepseek,普通电脑可用
· 按钮权限的设计及实现